public IActionResult Create([Bind("RackLocationID,LocationID,RackID,RackNo")] RackLocation rackLocation) { if (ModelState.IsValid) { service.Add(rackLocation); return(RedirectToAction(nameof(Index))); } ViewData["LocationID"] = new List <SelectListItem>(service.GetSelectListLocation()); ViewData["RackID"] = new List <SelectListItem>(service.GetSelectListRack()); return(View(rackLocation)); }
public async Task <IActionResult> CreateBrand(RackLocation_Main_Dto rackDto) { rackDto.Updated_By = "Emma"; if (_service.CheckExistRackLocation(rackDto)) { return(BadRequest("RackLocation already exists!")); } if (await _service.Add(rackDto)) { return(CreatedAtRoute("Filter", new { })); } throw new Exception("Creating the rack location failed on save"); }
public async Task <IActionResult> CreateBrand(RackLocation_Main_Dto rackDto) { var updateBy = User.FindFirst(ClaimTypes.Name).Value; rackDto.Updated_By = updateBy; if (_service.CheckExistRackLocation(rackDto)) { return(BadRequest("RackLocation already exists!")); } if (await _service.Add(rackDto)) { return(CreatedAtRoute("Filter", new { })); } throw new Exception("Creating the rack location failed on save"); }