public async Task <ActionResult> Edit(LeadsEditViewModel updateLeads) { if (ModelState.IsValid) { tbl_crm_leads updatedLead = Mapper.Map <LeadsEditViewModel, tbl_crm_leads>(updateLeads); tbl_emp_info loggedInUserInfo = Utilities.GetLoggedInUserInfo(User.Identity.Name); int? loggedInUser = loggedInUserInfo.Emp_ID; updatedLead.Generated_By = loggedInUser; updatedLead.UpdatedAt = DateTime.Now; ResponseMessage responseMessage = await leadsManager.EditAsync(updatedLead).ConfigureAwait(false); if (responseMessage.Type == Constant.RESPONSE_MESSAGE_TYPE_SUCCESS) { return(Json(GeneralMessages.SAVE_SUCCESSFUL, JsonRequestBehavior.AllowGet)); } else { return(Json(GeneralMessages.SAVE_FAILED, JsonRequestBehavior.AllowGet)); } } else { return(Json(GeneralMessages.SAVE_FAILED, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> Edit(int?id) { if (id == null) { return(Json(false)); } else { tbl_crm_leads findLead = await leadsManager.GetLeadByIdAsync(id).ConfigureAwait(false); LeadsEditViewModel leadEditViewModel = Mapper.Map <tbl_crm_leads, LeadsEditViewModel>(findLead); leadEditViewModel.CountryList = await leadsManager.GetAllCountryAsync().ConfigureAwait(false); leadEditViewModel.SourceList = await leadsManager.GetAllSourceAsync().ConfigureAwait(false); return(PartialView(leadEditViewModel)); } }