public async Task <Guid> AddOutbuildingTypeAsync(OutbuildingTypeDto outbuildingtype) { try { var validator = new OutbuildingTypeValidator(_unitOfWork.OutbuildingType); var validationResult = await validator.ValidateAsync(outbuildingtype); if (validationResult.Errors.Count > 0) { throw new ValidationException(validationResult); } var ob = _mapper.Map <OutbuildingsType>(outbuildingtype); ob = await _unitOfWork.OutbuildingType.AddAsync(ob); await _unitOfWork.SaveChangesAsync(); return(ob.Id); } catch (Exception ex) { throw ex; } }
public async Task UpdateOutbuildingTypeAsync(OutbuildingTypeDto outbuildingDto) { var outbuilding = _mapper.Map <OutbuildingsType>(outbuildingDto); await _unitOfWork.OutbuildingType.UpdateAsync(outbuilding); StatusClass = "alert-success"; Message = "Outbuilding updated successfully."; Saved = true; }