public bool UpdateDetails(QuantityUnitDto newDetails) { var details = newDetails.DtoToEntity(); if (_quantityUnit.Update2(details).IsNull()) { return(false); } return(true); }
public bool SaveDetails(QuantityUnitDto newDetails) { this.quantityUnit = newDetails.DtoToEntity(); if (this._quantityUnit.Insert(this.quantityUnit).IsNull()) { return(false); } return(true); }
public static IOBalanceDBV2Entity.QuantityUnit DtoToEntity(this QuantityUnitDto dto) { IOBalanceDBV2Entity.QuantityUnit entity = null; if (!dto.IsNull()) { entity = new IOBalanceDBV2Entity.QuantityUnit { QuantityUnitID = dto.QuantityUnitID, UnitName = dto.UnitName }; } return(entity); }
public virtual ActionResult UpdateDetails(QuantityUnitDto dto) { bool isSuccess = false; string alertMessage = string.Empty; if (ModelState.IsValid) { var duplicate = _quantityUnitService.GetAll().Where(c => c.UnitName == dto.UnitName && c.QuantityUnitID != dto.QuantityUnitID).Count(); if (duplicate >= 1) { alertMessage = (string.Format(Messages.DuplicateItem, "Unit")); } else { isSuccess = this._quantityUnitService.UpdateDetails(dto); if (!isSuccess) { alertMessage = string.Format(Messages.ErrorOccuredDuringProcessingThis, "updating in unit"); } else { alertMessage = (Messages.UpdateSuccess); } } } else { alertMessage = Messages.ErrorOccuredDuringProcessingOrRequiredFields; } var jsonResult = new { isSuccess = isSuccess, alertMessage = alertMessage }; return(Json(jsonResult, JsonRequestBehavior.AllowGet)); }