Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
 public Task AddBuildingOutbuildings(ComponentDto model)
 {
     throw new NotImplementedException();
 }