//Part of View
<div class="checkbox">
<label id="sendEmail" class="" >
<input id="sendEmailInput" type="checkbox" asp-for="CompanySetting.SendEmail">Send mail for jobs.
</label>
</div>
//Model
public partial class CompanySetting
{
public int CompanyId { get; set; }
public bool SendEmail { get; set; }
public virtual CompanyUsers Company { get; set; }
}
//Controller
public ActionResult AccountSettingSave(CompanyAccountViewModel model)
{
try
{
CompanySetting settingModel = _companySettingService.GetByCompanyId(GetId());
settingModel.SendEmail = model.CompanySetting.SendEmail;
_companySettingService.UpdateBill(settingModel);
TempDataMessage("message", "Hesap ayarları başarıyla güncellendi.");
return RedirectToAction("AccountSettings");
}
catch
{
TempDataMessage("message", "Hesap ayarları güncellenemedi.");
return RedirectToAction("AccountSettings");
}
}
Checbox does not affect model, it is always default value. probably checkbox returns just on. but i tried with javascript + extra one input and works . i dont want use javascirpt control