public static CustomerType FromModel(CustomerTypeModel model) { return(new CustomerType { Id = model.Id, Caption = model.Caption }); }
public IActionResult Index(CustomerTypeModel customerType) { int Discount; int Pricetotal = Total(customerType.Customer, productList, out Discount); return(RedirectToAction("Summation", new { Pricetotal = Pricetotal, Discount = Discount })); }
public ActionResult Edit(CustomerTypeModel model) { if (ModelState.IsValid) { bool has_error = false; if (!has_error) { try { var type = CustomerTypeModelConverter.FromModel(model); CustomerTypeService.Update(type); } catch (DomainException e) { ModelState.AddModelError("", e); has_error = true; } } if (!has_error) { return(RedirectToAction("List")); } } return(View()); }
// An async method to insert data in the database using Insight.Database // We insert a CustomerTypeModel as the parameter for the stored procedure public async Task <bool> InsertAsync(CustomerTypeModel model) { using (var connection = new SqlConnection(_connectionString)) { // we use the 'InsertCustomerType' store procedure from the database var result = await connection.ExecuteAsync("InsertCustomerType", model); return(result > 0); } }
public ActionResult DeleteCustmerType(CustomerTypeModel model) { if (ModelState.IsValid) { _details = new MasterModel(); Enums.CrudStatus status = _details.SetCustomerType(model, Enums.CrudType.Delete); ReturnAlertMessage(status); } return(View("AddCustmerType")); }
public virtual ActionResult Modify(CustomerTypeModel model) { if (model == null) { return(null); } var entity = model.CreateEntity(SaveType.Modify); var result = new Dictionary <string, object>(); var rev = this.SaveEntity(entity); var mess = rev ? "" : entity.Errors?.FirstOrDefault()?.Message; result.Add("Status", rev); result.Add("Message", mess); return(this.Jsonp(result)); }
public virtual ActionResult Get(long id) { var entity = this.GetEntity <CustomerTypeEntity>(id); if (entity == null) { return(null); } var model = new CustomerTypeModel { Id = entity.Id.ToString(), Name = entity.Name }; return(this.Jsonp(model)); }
public ActionResult Create(CustomerTypeModel model) { bool has_error = false; if (ModelState.IsValid) { try { CustomerTypeService.Create(model.Caption); } catch (DomainException e) { ModelState.AddModelError("", e); has_error = true; } } if (!has_error) { return(RedirectToAction("List")); } return(View("Edit")); }
public virtual ActionResult Add(CustomerTypeModel model) { if (model == null) { return(null); } var entity = model.CreateEntity(SaveType.Add); entity.Sequence = GetSequence(); var result = new Dictionary <string, object>(); entity.Crm = new CrmEntity { Id = CrmId }; var rev = this.SaveEntity(entity); var mess = rev ? "" : entity.Errors?.FirstOrDefault()?.Message; result.Add("Status", rev); result.Add("Id", entity.Id); result.Add("Message", mess); result.Add("Sequence", entity.Sequence); return(this.Jsonp(result)); }
public CustomerTypeSelectedEventArgs(CustomerTypeModel model) { this.model = model; }
public Task <bool> InsertAsync(CustomerTypeModel model) { return(_repository.InsertAsync(model)); }