private void btnSave_Click(object sender, EventArgs e) { try { if (!_isChanged) { return; } if (!ValidateModel()) { return; } SetModel(); if (_isAddNewMode) { _productUnit.Id = _productUnitService.Insert(_productUnit); } else { _productUnitService.Update(_productUnit); } LoadDataGridView(); _currentIndex = _productUnitList.FindIndex(r => r.Id == _productUnit.Id); LoadFormWithData(); MessageBox.Show(POSText.SaveMessage, MessageBoxCaptions.Success.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception exception) { MessageBox.Show(POSText.ErrorMessage, MessageBoxCaptions.Error.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public IActionResult Update(ProductUnit productUnit) { var result = _productUnitService.Update(productUnit); if (result.Success) { return(Ok(result.Message)); } return(BadRequest(result.Message)); }
public async Task <ActionResult <bool> > Update(UpdateProductUnitModel request) { return(Ok(await _productUnitService.Update(await GetUserId(), request, GetPermissionId()))); }