public ActionResult Test(string name = "demo") { var model = new AddSupplierModel() { Address = "北京市朝阳区华腾世纪总部公园", BusinessTimeStart = new TimeModel() { Hour = 8, Minute = 0 }, BusinessTimeEnd = new TimeModel() { Hour = 20, Minute = 0 }, CoordinatesLatitude = "42.324", CoordinatesLongitude = "152.324", DeliveryTime = new DeliveryTime[] { new DeliveryTime() { Start = new TimeModel() { Hour = 11, Minute = 0 }, End = new TimeModel() { Hour = 13, Minute = 30 } } }, Name = name, Tel = "13888888888" }; ApplicationRegistry.Supplier.Add(model); ViewBag.Name = name; return(View()); }
public async Task AddSupplier(AddSupplierModel model) { var supplier = _mapper.Map <AddSupplierModel, Supplier>(model); await Database.Suppliers.Create(supplier); await Database.Save(); }
public AddSupplierModel Create() { var model = new AddSupplierModel() { Address = "北京市朝阳区", BusinessTimeStart = new TimeModel() { Hour = 8, Minute = 0 }, BusinessTimeEnd = new TimeModel() { Hour = 20, Minute = 0 }, CoordinatesLatitude = "42.324", CoordinatesLongitude = "152.324", DeliveryTime = new DeliveryTime[] { new DeliveryTime() { Start = new TimeModel() { Hour = 11, Minute = 0 }, End = new TimeModel() { Hour = 13, Minute = 30 } } }, Name = "测试", Tel = "13888888888" }; return(model); }
public void AddTestH5V2() { var model = new AddSupplierModel() { Address = "北京市朝阳区", BusinessTimeStart = new TimeModel() { Hour = 8, Minute = 0 }, BusinessTimeEnd = new TimeModel() { Hour = 20, Minute = 0 }, CoordinatesLatitude = "42.324", CoordinatesLongitude = "152.324", DeliveryTime = new DeliveryTime[] { new DeliveryTime() { Start = new TimeModel() { Hour = 11, Minute = 0 }, End = new TimeModel() { Hour = 13, Minute = 30 } } }, Name = "测试", Tel = "13888888888" }; IReturn @iReturn = ApplicationRegistry.Supplier.Add(model); ResultWithData <string> result = @iReturn.Result(new ReturnContext() { SystemId = "h5", Version = "1" }); }
/// <summary> /// 创建餐厅 /// </summary> /// <param name="model">餐厅信息</param> /// <returns></returns> public IReturn Add(AddSupplierModel model) { Model.Supplier supplier = model.ToSupplier(); if (supplier.Validate()) { Model.RepositoryRegistry.Supplier.Add(supplier); } return this.Write("Add", supplier); }
public void AddSupplier(AddSupplierModel addSupplierModel) { this.db.Suppliers.Add(new Supplier() { Name = addSupplierModel.Name, IsImporter = addSupplierModel.Importer }); this.db.SaveChanges(); }
public async Task <IActionResult> RegisterSupplier(AddSupplierModel supplierModel) { if (!ModelState.IsValid) { return(await Task.Run(() => RedirectToAction("AddSuppliers"))); } await this.adminService.AddSupplier(supplierModel); return(RedirectToAction("AddSuppliers")); }
public async Task AddSupplier(AddSupplierModel supplierModel) { var newSupplier = new Supplier() { Name = supplierModel.Name, Email = supplierModel.Email }; this.context.Suppliers.Add(newSupplier); await this.context.SaveChangesAsync(); }
/// <summary> /// 创建餐厅 /// </summary> /// <param name="model"></param> /// <returns></returns> public IReturn Add(AddSupplierModel model) { M.Supplier supplier = model.ToSupplier(); if (supplier.Validate()) { M.RepositoryRegistry.Supplier.Add(supplier); return(this.WriteAndPublishDomainEvent <M.Supplier, AddDomainEvent>("Add", supplier, new AddDomainEvent(supplier.Id, supplier.Name, supplier.Tel, supplier.Address, supplier.CreateDate))); } return(this.Write("Add", supplier)); }
/// <summary> /// 更新餐厅信息 /// </summary> /// <param name="supplierId">餐厅ID</param> /// <param name="model">餐厅信息</param> /// <returns></returns> public IReturn Update(int supplierId, AddSupplierModel model) { M.Supplier supplier = M.RepositoryRegistry.Supplier.FindBy(supplierId); if (supplier != null) { model.ToSupplier(supplier); if (supplier.Validate()) { M.RepositoryRegistry.Supplier.Update(supplier); } } return(this.Write("Update", supplier)); }
/// <summary> /// 更新餐厅信息 /// </summary> /// <param name="supplierId">餐厅ID</param> /// <param name="model">餐厅信息</param> /// <returns></returns> public IReturn Update(int supplierId, AddSupplierModel model) { Model.Supplier supplier = Model.RepositoryRegistry.Supplier.FindBy(supplierId); if (supplier != null) { model.ToSupplier(supplier); if (supplier.Validate()) { Model.RepositoryRegistry.Supplier.Update(supplier); } } return this.Write("Update", supplier); }
public IActionResult Add(AddSupplierModel addSupplierModel) { this.simpleLoggerService.LogToDb(this.User.Identity.Name, LogType.Add, "Suppliers"); if (this.ModelState.IsValid) { this.supplierService.AddSupplier(addSupplierModel); this.TempData["Success"] = "Supplier added successfully."; return(RedirectToAction(nameof(List))); } this.TempData["Error"] = "There was an error with your request."; return(View(addSupplierModel)); }
public async Task <AddSupplierResponseModel> AddSupplier([FromBody] AddSupplierModel model) { return(await personService.AddSupplierAsync(model.Portfolio, model.UserName, model.PasswordHash)); }
public AddSupplierModel Create() { var model = new AddSupplierModel() { Name = "好美味餐厅", Address = "北京朝阳区", Tel = "010-98989", CoordinatesLatitude = "13.2565665889", CoordinatesLongitude = "15.564654646", BusinessTimeStart = new TimeModel() { Hour = 0, Minute = 0 }, BusinessTimeEnd = new TimeModel() { Hour = 23, Minute = 59 }, DeliveryTime = new DeliveryTime[1] { new DeliveryTime() { Start = new TimeModel() { Hour = 11, Minute = 0 }, End = new TimeModel() { Hour = 13, Minute = 0 } } }, }; return model; }
public IHttpActionResult Add(AddSupplierModel model) { IReturn @return = ApplicationRegistry.Supplier.Add(model); return Json(@return.Result(new ReturnContext())); }
public ActionResult AddSupplier(AddSupplierModel model) { bool addedSupplier; string errorMessage; Supplier formSupplierData = null; try { if (model.IsValid(out errorMessage)) { using (ProductListContext productContext = new ProductListContext()) { // insert the supplier productContext.AddSupplier(model.Name, model.PhoneNumber); productContext.SaveChanges(); } addedSupplier = true; } else { // save form data for when we return formSupplierData = new Supplier { SupplierID = -1, Name = model.Name, PhoneNumber = model.PhoneNumber }; addedSupplier = false; } } catch (Exception e) { addedSupplier = false; errorMessage = Errors.GenericMVCInternalError; ErrorLog.LogError(e); } ActionResult result; if (addedSupplier) { // Added supplier, return to list ProductListModel viewModel = new ProductListModel { AddedOrUpdatedProduct = true }; result = RedirectToAction("Index", viewModel); } else { // Error, show message AddUpdateSupplierViewModel viewModel = AddUpdateSupplierViewModel.GetModel(formSupplierData, errorMessage); result = View("AddUpdateSupplier", viewModel); } return(result); }
public async Task <IActionResult> AddSupplier(AddSupplierModel model) { await _adminService.AddSupplier(model); return(RedirectToAction("Add")); }