public ActionResult Add(CampaignViewModel viewModel) { if (ModelState.IsValid) { OperationContext.ServiceSession.EM_CampaignsService.Add(viewModel.ToPOCO()); OperationContext.ServiceSession.SaveChange(); return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationSuccess, "", "", null); } else { return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationFailed, "Please enable javascript in browser.", "", null); } }
public ActionResult Modify(int id, CampaignViewModel viewmodel) { if (ModelState.IsValid) { viewmodel.CampaignID = id; OperationContext.ServiceSession.EM_CampaignsService.Update(viewmodel.ToPOCO(), "CampaignDesc", "CampaignName", "UpdatedBy", "UpdatedDate", "StartDate", "EndDate"); OperationContext.ServiceSession.SaveChange(); string hasEmail = string.Empty; string emailInstanceId=string.Empty; if (OperationContext.ServiceSession.EM_EmailInstancesService.Get(e => e.CampaignID == id).FirstOrDefault() != null) { hasEmail = "hasEmail"; emailInstanceId = OperationContext.ServiceSession.EM_EmailInstancesService.Get(e => e.CampaignID == id) .FirstOrDefault() .EmailInstanceID.ToString(); //ViewBag.emailInstanceId = emailInstanceId; } return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationSuccess, hasEmail, "",emailInstanceId); } return OperationContext.SendAjaxMessage(AjaxMessageStatus.OperationFailed, "Please enable javascript in the browser", "", null); }