public IActionResult EditZone([FromBody] ManageZoneAdd manageZone) { try { Validator.validateZoneAdd(manageZone); DAZone dAZone = new DAZone(); return(this.OKResponse(dAZone.EditZone(manageZone, _context, User.ToAppUser()) ? "Zone Updated" : "Zone Updation Failed")); } catch (DataValidationException ex) { return(this.KnowOperationError(ex.Message)); } }
public static void validateZoneAdd(ManageZoneAdd manageZone) { if (string.IsNullOrEmpty(manageZone.ZoneName)) { throw new DataValidationException($"ZoneName does not exists"); } if (string.IsNullOrEmpty(manageZone.Unit)) { throw new DataValidationException($"Unit does not exists"); } if (manageZone.Serviceslocid == 0) { throw new DataValidationException($"Serviceslocid does not exists"); } }