//Cập nhật Brand public async Task <bool> Update(SuppilerDto model) { var Line = _mapper.Map <Supplier>(model); _repoLine.Update(Line); return(await _repoLine.SaveAll()); }
public async Task <IActionResult> Update(SuppilerDto update) { if (await _supplierService.Update(update)) { return(NoContent()); } return(BadRequest($"Updating model name {update.ID} failed on save")); }
//Thêm Supplier mới vào bảng Supplier public async Task <bool> Add(SuppilerDto model) { var Supplier = _mapper.Map <Supplier>(model); Supplier.isShow = true; _repoSupplier.Add(Supplier); return(await _repoSupplier.SaveAll()); }
public async Task <IActionResult> Create(SuppilerDto create) { if (_supplierService.GetById(create.ID) != null) { return(BadRequest("Line ID already exists!")); } //create.CreatedDate = DateTime.Now; if (await _supplierService.Add(create)) { return(NoContent()); } throw new Exception("Creating the model name failed on save"); }
//Cập nhật Supplier public async Task <bool> Update(SuppilerDto model) { string token = _accessor.HttpContext.Request.Headers["Authorization"]; var userID = JWTExtensions.GetDecodeTokenByProperty(token, "nameid").ToInt(); if (userID == 0) { return(false); } var supplier = _mapper.Map <Supplier>(model); supplier.isShow = true; supplier.ModifiedBy = userID; supplier.ModifiedDate = DateTime.Now; _repoSupplier.Update(supplier); return(await _repoSupplier.SaveAll()); }