public async Task <Guid> AddComponent(ComponentDto component) { try { var validator = new ComponentValidator(_unitOfWork.Components); var validationResult = await validator.ValidateAsync(component); if (validationResult.Errors.Count > 0) { throw new ValidationException(validationResult); } var Componentt = _mapper.Map <Component>(component); Componentt = await _unitOfWork.Components.AddAsync(Componentt); await _unitOfWork.SaveChangesAsync(); return(Componentt.Id); } catch (Exception ex) { throw ex; } }
public async Task UpdateComponent(ComponentDto componentDto) { var component = _mapper.Map <Component>(componentDto); await _unitOfWork.Components.UpdateAsync(component); StatusClass = "alert-success"; Message = "Component updated successfully."; Saved = true; }
public Task AddBuildingOutbuildings(ComponentDto model) { throw new NotImplementedException(); }