public static MCustomer MCustomerEmpty(this BoCustomer oBCustomer) { var lObject = LiUtilsLib.bll_GetObjectByName(MGlobalVariables.LNameObjectCustomer); var lMCustomer = new MCustomer { LObject = new MObject { LIdObject = lObject.LIdObject, LNameObject = lObject.LNameObject }, LStatus = new MStatus { LDsEstado = null, LIdStatus = null }, LTypeIdentification = new MTypeIdentification { LIdTypeIdentification = 0, LTypeIdentification = null }, LListTypeIdentification = new List <SelectListItem>(), LListStatus = new List <SelectListItem>(), LNameCustomer = null, LLastNameCustomer = null, LNoIdentification = null, LIdCustomer = 0, LCreationDate = new DateTime(), LModificationDate = new DateTime() }; lMCustomer.LListTypeIdentification = LiTypeIdentification.bll_getListTypeIdentification().MListAllTypeIdentificationWithSelect(true); lMCustomer.LListStatus = LiStatus.Bll_getListStatusByIdObject(lMCustomer.LObject.LIdObject).MListStatusWithSelect(); return(lMCustomer); }
public bool CheckCustomerIsBlockOrNot() { bool status = false; MCustomer cust = new MCustomer(); //var checkCustomer = auctionContext.Sales.Where(x=>x.dtCreditLimitDate>DateTime.Now); var checkCustomer = (from AM in auctionContext.Sales join t1 in auctionContext.MCustomers on AM.iCustomerID equals t1.iCustomerID where (AM.dtCreditLimitDate) < DateTime.Now //yourDate.Date >= DateTime.Now.Date select t1 ).ToList(); if (checkCustomer != null) { foreach (var item in checkCustomer) { //Save // var customer = auctionContext.MCustomers.Where(x => x.iCustomerID==item.iCustomerID).FirstOrDefault(); //customer.IsBlocked = true; //auctionContext.MCustomers.Add(item); item.IsBlocked = true; } } auctionContext.SaveChanges(); status = true; return(status); }
private void txt_CustId_Validating(object sender, CancelEventArgs e) { if (!string.IsNullOrEmpty(txt_CustId.Text.Trim())) { if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSalesVIP.ToString())) { MCustomer cust = (MCustomer)DataMaster.GetObjectByProperty(typeof(MCustomer), MCustomer.ColumnNames.CustomerId, txt_CustId.Text); if (cust != null) { txt_CustName.Text = cust.CustomerName; } else { txt_CustName.ResetText(); } } else { MSupplier supp = (MSupplier)DataMaster.GetObjectByProperty(typeof(MSupplier), MSupplier.ColumnNames.SupplierId, txt_CustId.Text); if (supp != null) { txt_CustName.Text = supp.SupplierName; } else { txt_CustName.ResetText(); } } } }
public void AddCustomer(MCustomer customer) { var map = mapper.Map(customer); context.Add(map); context.SaveChanges(); }
public static List <MCustomer> GetALlCustomers() { List <MCustomer> lstCustomer = new List <MCustomer>(); try { string sql = "SELECT * FROM M_CUSTOMERS"; var result = SQLiteCommon.ExecuteSqlWithResult(sql); if (result != null && result.HasRows) { while (result.Read()) { MCustomer customer = new MCustomer(); customer.ID = long.Parse(result["ID"]?.ToString()); customer.CompanyName = result["COMPANYNAME"]?.ToString(); customer.CompanyAddress = result["COMPANYADDRESS"]?.ToString(); customer.CompanyMobile = result["COMPANYMOBILE"]?.ToString(); customer.CusName = result["CUSNAME"]?.ToString(); customer.CusEmail = result["CUSEMAIL"]?.ToString(); customer.CusMobile = result["CUSMOBILE"]?.ToString(); customer.CreateDate = Convert.ToDateTime(result["CREATEDATE"]?.ToString()); lstCustomer.Add(customer); } } return(lstCustomer); } catch (Exception ex) { throw ex; } }
public ActionResult Edit(int id, MCustomer pMCustomer) { try { if (this.ModelState.IsValid) { var lMessage = this.LiCustomerFacade.bll_UpdateCustomer(id, pMCustomer.LNameCustomer, pMCustomer.LLastNameCustomer, pMCustomer.LNoIdentification, Convert.ToInt32(this.Request.Form[EFields.LFieldListTypeIdentification]), Convert.ToInt32(this.Request.Form[EFields.LFieldListObject]), this.Request.Form[EFields.LFieldListStatus]); if (lMessage == null) { return(this.RedirectToAction("Index")); } pMCustomer.LMessageException = lMessage; ListEmptyCustomer(pMCustomer); return(this.View(pMCustomer)); } ListEmptyCustomer(pMCustomer); return(this.View(pMCustomer)); } catch (Exception e) { pMCustomer.LMessageException = e.Message; ListEmptyCustomer(pMCustomer); return(this.View(pMCustomer)); } }
public ActionResult Create(MCustomer pMCustomer) { try { if (this.ModelState.IsValid) { var lMessage = this.LiCustomerFacade.bll_InsertCustomer(pMCustomer.LNameCustomer, pMCustomer.LLastNameCustomer, pMCustomer.LNoIdentification, Convert.ToInt32(this.Request.Form[EFields.LFieldListTypeIdentification]), Convert.ToInt32(this.Request.Form[EFields.LFieldListObject]), this.LiUtilsLib.bll_getStatusApproByObject(this.LiUtilsLib.bll_GetObjectByName(MGlobalVariables.LNameObjectCustomer).LIdObject).LIdStatus); if (lMessage == null) { return(this.RedirectToAction("Index")); } pMCustomer.LMessageException = lMessage; if (lMessage.Contains(CodesError.LConstraintCustomer)) { pMCustomer.LMessageException = CodesError.LMsgCustomerExists; } ListEmptyCustomer(pMCustomer); return(this.View(pMCustomer)); } ListEmptyCustomer(pMCustomer); return(this.View(pMCustomer)); } catch (Exception e) { pMCustomer.LMessageException = e.Message; ListEmptyCustomer(pMCustomer); return(this.View(pMCustomer)); } }
private MCustomer ParserAddCustomer(Customer customer) { MCustomer mCustomer = new MCustomer(); if (customer != null) { mCustomer.iCustomerID = customer.iCustomerID; mCustomer.strFirstName = customer.strFirstName ?? " "; mCustomer.strMiddleName = customer.strMiddleName ?? " "; mCustomer.strLastName = customer.strLastName ?? " "; mCustomer.iCountry = customer.iCountry; mCustomer.iCity = customer.iCity; mCustomer.strEmailID = customer.strEmailID ?? " "; mCustomer.iPhoneNumber = customer.iPhoneNumber; mCustomer.strAddress = customer.strAddress ?? " "; mCustomer.iPincode = customer.iPincode; mCustomer.strCreditLimit = customer.strCreditLimit ?? " "; mCustomer.strPersonFirstName = customer.strPersonFirstName ?? " "; mCustomer.strPersonMiddleName = customer.strPersonMiddleName ?? " "; mCustomer.strPersonLastName = customer.strPersonLastName ?? " "; mCustomer.strCompanyName = customer.strCompanyName ?? " "; mCustomer.CustomerPhoto = customer.CustomerPhoto ?? " "; mCustomer.CustomerDate = customer.CustomerDate ?? " "; mCustomer.iCreditCategoryID = customer.iCreditCategoryID; mCustomer.IsBlocked = customer.IsBlocked; } return(mCustomer); }
public static MCustomer MCustomerById(this BoCustomer oBCustomer) { var oMCustomer = new MCustomer { LObject = new MObject { LIdObject = oBCustomer.LObject.LIdObject, LNameObject = oBCustomer.LObject.LNameObject }, LStatus = new MStatus { LDsEstado = oBCustomer.LStatus.LDsEstado, LIdStatus = oBCustomer.LStatus.LIdStatus }, LTypeIdentification = new MTypeIdentification { LIdTypeIdentification = oBCustomer.LTypeIdentification.LIdTypeIdentification, LTypeIdentification = oBCustomer.LTypeIdentification.LTypeIdentification }, LListTypeIdentification = new List <SelectListItem>(), LListStatus = new List <SelectListItem>(), LNameCustomer = oBCustomer.LNameCustomer, LLastNameCustomer = oBCustomer.LLastNameCustomer, LNoIdentification = oBCustomer.LNoIdentification, LIdCustomer = oBCustomer.LIdCustomer, LCreationDate = oBCustomer.LCreationDate, LModificationDate = oBCustomer.LModificationDate }; oMCustomer.LListTypeIdentification = LiTypeIdentification.bll_getListTypeIdentification().MListAllTypeIdentification(); oMCustomer.LListStatus = LiStatus.Bll_getListStatusByIdObject(oBCustomer.LObject.LIdObject).MListAllStatus(); return(oMCustomer); }
public MCustomer Get(int id) { MCustomer customer = new MCustomer(); customer = auctionContext.MCustomers.Where(a => a.iCustomerID == id).FirstOrDefault(); return(customer); }
private void ConvertToCustomer(CustomerViewModel custVM, MCustomer cust) { cust.CustomerName = custVM.CustomerName; cust.CustomerPhone = custVM.CustomerPhone; cust.CustomerAddress = custVM.CustomerAddress; cust.CustomerContactName = custVM.CustomerContactName; cust.CustomerContactPhone = custVM.CustomerContactPhone; }
private void ConvertToCustomer(CustomerViewModel custVM, MCustomer cust) { cust.CustomerName = custVM.CustomerName; cust.CustomerPhone = custVM.CustomerPhone; cust.CustomerAddress = custVM.CustomerAddress; cust.CustomerType = custVM.CustomerType; //cust.CustomerCity = custVM.CustomerCity; cust.CityId = string.IsNullOrEmpty(custVM.CityId) ? null : _cityTasks.One(custVM.CityId); }
private void bindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (!ValidateForm()) { return; } if (customerIdTextBox.Enabled == true) { cust = new MCustomer(); } else { cust = (MCustomer)DataMaster.GetObjectById(typeof(MCustomer), customerIdTextBox.Text); } cust.CustomerAddress = customerAddressTextBox.Text; cust.CustomerDisc = decimal.Zero; //cust.CustomerDesc = customerDescTextBox.Text; //cust.CustomerDesc2 = customerDesc2TextBox.Text; cust.CustomerFax = customerFaxTextBox.Text; cust.CustomerId = customerIdTextBox.Text; cust.CustomerLimit = decimal.Zero; cust.CustomerName = customerNameTextBox.Text; cust.CustomerPhone = customerPhoneTextBox.Text; cust.CustomerStatus = ListOfCustStatus.Active.ToString(); cust.SubAccountId = string.Empty; cust.ModifiedBy = lbl_UserName.Text; cust.ModifiedDate = DateTime.Now; if (customerIdTextBox.Enabled == true) { try { DataMaster.SavePersistence(cust); } catch (NHibernate.NonUniqueObjectException) { RecreateBalloon(); balloonHelp.Caption = "Validasi data kurang"; balloonHelp.Content = "Pelanggan dengan kode " + customerIdTextBox.Text + " sudah pernah diinput, silahkan input dengan kode yang lain"; balloonHelp.ShowBalloon(customerIdTextBox); customerIdTextBox.Focus(); return; } ModuleControlSettings.SaveLog(ListOfAction.Insert, customerIdTextBox.Text, ListOfTable.MCustomer, lbl_UserName.Text); } else { DataMaster.UpdatePersistence(cust); ModuleControlSettings.SaveLog(ListOfAction.Update, customerIdTextBox.Text, ListOfTable.MCustomer, lbl_UserName.Text); } BindData(); }
private static void TransferFormValuesTo(MCustomer mCustomerToUpdate, MCustomer mCustomerFromForm) { mCustomerToUpdate.CustomerHealthProblem = mCustomerFromForm.CustomerHealthProblem; mCustomerToUpdate.CustomerJoinDate = mCustomerFromForm.CustomerJoinDate; mCustomerToUpdate.CustomerLastBuy = mCustomerFromForm.CustomerLastBuy; mCustomerToUpdate.CustomerProductDisc = mCustomerFromForm.CustomerProductDisc; mCustomerToUpdate.CustomerServiceDisc = mCustomerFromForm.CustomerServiceDisc; mCustomerToUpdate.CustomerStatus = mCustomerFromForm.CustomerStatus; mCustomerToUpdate.CustomerMassageStrength = mCustomerFromForm.CustomerMassageStrength; mCustomerToUpdate.CustomerDesc = mCustomerFromForm.CustomerDesc; }
public ActionResult InsertOrUpdate(MCustomer viewModel, FormCollection formCollection) { if (formCollection["oper"].Equals("add")) { return(Insert(viewModel, formCollection)); } else if (formCollection["oper"].Equals("edit")) { return(Update(viewModel, formCollection)); } return(View()); }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(customerIdTextBox.Text.Trim())) { if (MessageBox.Show("Anda yakin menghapus data?", "Konfirmasi Hapus Data", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { cust = (MCustomer)DataMaster.GetObjectByProperty(typeof(MCustomer), MCustomer.ColumnNames.CustomerId, customerIdTextBox.Text); DataMaster.Delete(cust); BindData(); } } }
private string GetCustomerName(string customerId) { if (!string.IsNullOrEmpty(customerId)) { MCustomer cust = _mCustomerRepository.Get(customerId); if (cust != null) { return(cust.PersonId.PersonName); } } return(string.Empty); }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(customerIdTextBox.Text.Trim())) { if (MessageBox.Show("Anda yakin menghapus data?", "Konfirmasi Hapus Data", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { cust = (MCustomer)DataMaster.GetObjectById(typeof(MCustomer), customerIdTextBox.Text); DataMaster.Delete(cust); ModuleControlSettings.SaveLog(ListOfAction.Delete, customerIdTextBox.Text, ListOfTable.MCustomer, lbl_UserName.Text); BindData(); } } }
private static SelectList GetCustomerList() { IMCustomerRepository mCustomerRepository = new MCustomerRepository(); var listCustomer = mCustomerRepository.GetAll(); MCustomer mCustomer = new MCustomer(); //mCustomer.SupplierName = "-Pilih Supplier-"; listCustomer.Insert(0, mCustomer); var custs = from cust in listCustomer select new { Id = cust.Id, Name = cust.PersonId != null ? cust.PersonId.PersonName : "-Pilih Konsumen-" }; return(new SelectList(custs, "Id", "Name")); }
public ActionResult CheckCustomer(string customerId) { if (!string.IsNullOrEmpty(customerId)) { MCustomer c = _mCustomerRepository.Get(customerId); if (c != null) { return(Content(false.ToString().ToLower())); } } return(Content(true.ToString().ToLower())); }
private MCustomer ParserAddCustomer(Customer customer) { MCustomer mCustomer = new MCustomer(); if (customer != null) { mCustomer.iCustomerID = customer.iCustomerID; mCustomer.strFirstName = customer.strFirstName ?? " "; mCustomer.strMiddleName = customer.strMiddleName ?? " "; mCustomer.strLastName = customer.strLastName ?? " "; mCustomer.iCountry = customer.iCountry; mCustomer.iCity = customer.iCity; mCustomer.strEmailID = customer.strEmailID ?? " "; mCustomer.fltPhoneNumber = customer.fltPhoneNumber; mCustomer.strAddress = customer.strAddress ?? " "; mCustomer.strPincode = customer.strPincode; mCustomer.strCreditLimit = customer.strCreditLimit; mCustomer.strPersonFirstName = customer.strPersonFirstName ?? " "; mCustomer.strPersonMiddleName = customer.strPersonMiddleName ?? " "; mCustomer.strPersonLastName = customer.strPersonLastName ?? " "; mCustomer.strPersonPhoneNo = customer.strPersonPhoneNo ?? " "; mCustomer.strShowRoomName = customer.strShowRoomName ?? " "; mCustomer.strShowRoomNumber = customer.strShowRoomNumber ?? " "; mCustomer.strBlock = customer.strBlock ?? " "; mCustomer.strShowRoomPhoneNo = customer.strShowRoomPhoneNo ?? " "; mCustomer.CustomerPhoto = customer.CustomerPhoto ?? " "; mCustomer.CustomerDate = customer.CustomerDate ?? " "; mCustomer.iCreditCategoryID = customer.iCreditCategoryID; mCustomer.IsBlocked = customer.IsBlocked; mCustomer.strQRCode = customer.strQRCode; mCustomer.IsActive = customer.IsActive; mCustomer.strQRCodePath = customer.strQRCodePath; mCustomer.iCutomerTypeID = customer.iCutomerTypeID; mCustomer.dtExpiryDate = customer.dtExpiryDate; mCustomer.strExpiryDate = customer.strExpiryDate ?? " "; mCustomer.strPcCode = customer.strPcCode ?? " "; mCustomer.fltPassportNo = customer.fltPassportNo; mCustomer.IDCopy = customer.IDCopy; mCustomer.IDCopyName = customer.IDCopyName; mCustomer.VisaCopy = customer.VisaCopy; mCustomer.VisaCopyName = customer.VisaCopyName; } return(mCustomer); }
private void bindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (!ValidateForm()) { return; } if (customerIdTextBox.Enabled == true) { cust = new MCustomer(); } else { cust = (MCustomer)DataMaster.GetObjectByProperty(typeof(MCustomer), MCustomer.ColumnNames.CustomerId, customerIdTextBox.Text); } cust.CustomerAddress = customerAddressTextBox.Text; cust.CustomerId = customerIdTextBox.Text; cust.CustomerName = customerNameTextBox.Text; cust.CustomerPhone = customerPhoneTextBox.Text; //cust.CustomerStatus = customerStatusComboBox.Text; cust.CustomerStatus = ListOfCustStatus.Active.ToString(); cust.CustomerDisc = Convert.ToDecimal(customerDiscTextBox.Text); cust.ModifiedBy = lbl_UserName.Text; cust.ModifiedDate = DateTime.Now; if (customerIdTextBox.Enabled == true) { try { DataMaster.SavePersistence(cust); } catch (NHibernate.NonUniqueObjectException) { RecreateBalloon(); balloonHelp.Caption = "Validasi data kurang"; balloonHelp.Content = "Pelanggan dengan kode " + customerIdTextBox.Text + " sudah pernah diinput, silahkan input dengan kode yang lain"; balloonHelp.ShowBalloon(customerIdTextBox); customerIdTextBox.Focus(); return; } } else { DataMaster.UpdatePersistence(cust); } BindData(); }
public static void CustomerValidating(string customerId, TextBox customerNameTextBox) { DataMasterMgtServices DataMaster = new DataMasterMgtServices(); MCustomer cust = (MCustomer)DataMaster.GetObjectByProperty(typeof(MCustomer), MCustomer.ColumnNames.CustomerId, customerId); if (cust != null) { customerNameTextBox.Text = cust.CustomerName; } else { customerNameTextBox.ResetText(); } }
public virtual ActionResult GetList() { var brands = _mCustomerRepository.GetAll(); StringBuilder sb = new StringBuilder(); MCustomer cust = new MCustomer(); sb.AppendFormat("{0}:{1}", string.Empty, "-Pilih Konsumen-"); for (int i = 0; i < brands.Count; i++) { cust = brands[i]; sb.AppendFormat(";{0}:{1}", cust.Id, cust.PersonId.PersonName); } return(Content(sb.ToString())); }
private void transactionByTextBox_Validating(object sender, CancelEventArgs e) { if (!string.IsNullOrEmpty(transactionByTextBox.Text.Trim())) { if (trans.Equals(ListOfTransaction.Sales) || trans.Equals(ListOfTransaction.ReturSales) || trans.Equals(ListOfTransaction.SalesVIP) || trans.Equals(ListOfTransaction.ReturSalesVIP)) { MCustomer cust = (MCustomer)DataMaster.GetObjectByProperty(typeof(MCustomer), MCustomer.ColumnNames.CustomerId, transactionByTextBox.Text); if (cust != null) { transactionByTextBox_Name.Text = cust.CustomerName; } else { transactionByTextBox_Name.ResetText(); } } else if (trans.Equals(ListOfTransaction.Usage) || trans.Equals(ListOfTransaction.Correction)) { MEmployee emp = (MEmployee)DataMaster.GetObjectByProperty(typeof(MEmployee), MEmployee.ColumnNames.EmployeeId, transactionByTextBox.Text); if (emp != null) { transactionByTextBox_Name.Text = emp.EmployeeName; } else { transactionByTextBox_Name.ResetText(); } } else if (trans.Equals(ListOfTransaction.PurchaseOrder) || trans.Equals(ListOfTransaction.Purchase) || trans.Equals(ListOfTransaction.ReturPurchase)) { MSupplier supp = (MSupplier)DataMaster.GetObjectByProperty(typeof(MSupplier), MSupplier.ColumnNames.SupplierId, transactionByTextBox.Text); if (supp != null) { transactionByTextBox_Name.Text = supp.SupplierName; if (trans.Equals(ListOfTransaction.Purchase)) { ModuleControlSettings.SetTransactionTextBoxSuggest(transactionReferenceIdTextBox, ListOfTransaction.PurchaseOrder, supp.SupplierId); } } else { transactionByTextBox_Name.ResetText(); } } } }
public ActionResult Insert(MCustomer viewModel, FormCollection formCollection) { RefAddress address = new RefAddress(); TransferFormValuesTo(address, formCollection); address.SetAssignedIdTo(Guid.NewGuid().ToString()); address.CreatedDate = DateTime.Now; address.CreatedBy = User.Identity.Name; address.DataStatus = EnumDataStatus.New.ToString(); _refAddressRepository.Save(address); RefPerson person = new RefPerson(); TransferFormValuesTo(person, formCollection); person.SetAssignedIdTo(Guid.NewGuid().ToString()); person.CreatedDate = DateTime.Now; person.CreatedBy = User.Identity.Name; person.DataStatus = EnumDataStatus.New.ToString(); _refPersonRepository.Save(person); UpdateNumericData(viewModel, formCollection); MCustomer mCustomerToInsert = new MCustomer(); TransferFormValuesTo(mCustomerToInsert, viewModel); mCustomerToInsert.SetAssignedIdTo(viewModel.Id); mCustomerToInsert.CreatedDate = DateTime.Now; mCustomerToInsert.CreatedBy = User.Identity.Name; mCustomerToInsert.DataStatus = EnumDataStatus.New.ToString(); mCustomerToInsert.AddressId = address; mCustomerToInsert.PersonId = person; _mCustomerRepository.Save(mCustomerToInsert); try { _mCustomerRepository.DbContext.CommitChanges(); } catch (Exception e) { _mCustomerRepository.DbContext.RollbackTransaction(); //throw e.GetBaseException(); return(Content(e.GetBaseException().Message)); } return(Content("success")); }
public IActionResult Put([FromBody] MCustomer customer) { try { if (customer == null) { return(BadRequest("Data is invalid or null")); } repo.UpdateCustomer(customer); return(NoContent()); } catch (Exception e) { return(StatusCode(400, e.Message)); } }
public static List <MCustomer> MListCustomer(this List <BoCustomer> oBListCustomer) { var oMListCustomer = new List <MCustomer>(); oBListCustomer.ForEach(x => { var oMCustomer = new MCustomer { LNameCustomer = x.LNameCustomer, LNoIdentification = x.LNoIdentification, LIdCustomer = x.LIdCustomer, LCreationDate = x.LCreationDate, LLastNameCustomer = x.LLastNameCustomer }; oMListCustomer.Add(oMCustomer); }); return(oMListCustomer); }
public ActionResult Delete(int id, MCustomer pMCustomer) { try { var lMessage = this.LiCustomerFacade.bll_DeleteCustomer(id); if (lMessage == null) { return(this.RedirectToAction("Index")); } pMCustomer.LMessageException = lMessage; return(this.View(pMCustomer)); } catch (Exception e) { pMCustomer.LMessageException = e.Message; return(this.View(pMCustomer)); } }
public ActionResult Customers_Create([DataSourceRequest] DataSourceRequest request, CustomerViewModel custVM) { if (custVM != null && ModelState.IsValid) { MCustomer cust = new MCustomer(); cust.SetAssignedIdTo(Guid.NewGuid().ToString()); ConvertToCustomer(custVM, cust); cust.CreatedDate = DateTime.Now; cust.CreatedBy = User.Identity.Name; cust.DataStatus = "New"; _customerTasks.Insert(cust); } return(Json(new[] { custVM }.ToDataSourceResult(request, ModelState))); }