Example #1
0
 /// <summary>
 /// The GetStandard
 /// </summary>
 /// <param name="id">The id<see cref="int"/></param>
 /// <returns>The <see cref="ServiceResult"/></returns>
 public ServiceResult GetStandard(int id)
 {
     return(new ServiceResult(true)
     {
         Data = _repository.Get(x => x.Identifier == id)
     });
 }
Example #2
0
        public string Execute(Domain.Standard.Standard standard)
        {
            var existStandard = _standardRepository.Get(standard.StandardID);

            if (standard.Active != existStandard.Active)
            {
                standard.Aspects = existStandard.Aspects;
            }

            string response = _standardRepository.Update(standard);

            switch (response)
            {
            case "NameExist":
                throw new DuplicateEntityException(standard.Name, "Ya existe una norma con este nombre o código", 436);

            case "OneActive":
                throw new DuplicateEntityException(standard.Name, "Debe existir al menos un aspecto activo.", 436);

            default:
                return("Ok");
            }
        }
 public StandardOutput Execute(int id)
 {
     return(_mapper.Map <Domain.Standard.Standard, StandardOutput>(_standardRepository.Get(id)));
 }
Example #4
0
        public async Task <Standard> GetStandard(string standardUId)
        {
            var standard = await _standardsRepository.Get(standardUId);

            return((Standard)standard);
        }