public async Task <BaseResult> CreateOrUpdate(InventoryAttributeModel model, int updateBy = 0, string updateByUserName = "") { var InventoryAttribute = model.ToInventoryAttribute(); //Cập nhật thông tin chung của thực thể InventoryAttribute = InventoryAttribute.UpdateCommonInt(updateBy, updateByUserName); if (InventoryAttribute.Id > 0) { //Cập nhật return(await Update(InventoryAttribute)); } else { //Thêm mới return(await Create(InventoryAttribute)); } }
public async Task <IActionResult> CreateOrUpdate([FromBody] InventoryAttributeModel InventoryAttribute) { var result = await _inventoryAttributeService.CreateOrUpdate(InventoryAttribute); return(Ok(result)); }
public static InventoryAttribute ToInventoryAttribute(this InventoryAttributeModel model) { return(model.MapTo <InventoryAttributeModel, InventoryAttribute>()); }