예제 #1
0
        /// <summary>
        /// The Save
        /// </summary>
        /// <param name="entity">The entity<see cref="Standard"/></param>
        /// <returns>The <see cref="ServiceResult"/></returns>
        public ServiceResult Save(Standard entity)
        {
            try
            {
                if (entity.Identifier == 0)
                {
                    _repository.Add(entity);
                }
                else
                {
                    _repository.Update(entity);
                }

                return(new ServiceResult(true));
            }
            catch (Exception ex)
            {
                return(new ServiceResult(false)
                {
                    Error = ex.ToString()
                });
            }
        }
예제 #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");
            }
        }
예제 #3
0
 public void UpdateStandard(Standard standard)
 {
     _standardRepository.Update(standard);
 }
예제 #4
0
 public void updateStandard(Standard Standard)
 {
     _standardRepository.Update(Standard);
 }
        } //close addStandard(...)

        public void updateStandard(Standard updateStandardItem)
        {
            _standardRepository.Update(updateStandardItem);
        } //close updateStandard(...)
예제 #6
0
 public void updateStandard(Standard departments)
 {
     standardRepository.Update(departments);
 }
예제 #7
0
 public void UpdateStandard(Standard standard)
 {
     standardRepository.Update(standard);
     //throw new NotImplementedException();
 }