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"); }