コード例 #1
0
        public NotificationResult Atualizar(Item entidade)
        {
            var NotificationResult = new NotificationResult();

            try
            {
                if (entidade.CodItem != 0)
                {
                    entidade.CodItem = entidade.CodItem;
                }

                if (NotificationResult.IsValid)
                {
                    _itemRepositorio.Atualizar(entidade);
                    NotificationResult.Add("Cadastro Alterado com Sucesso!");

                    return(NotificationResult);
                }

                else
                {
                    return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER)));
                }
            }
            catch (Exception)
            {
                return(NotificationResult.Add(new NotificationError("O codigo informado não existe!", NotificationErrorType.USER)));
            }
        }
コード例 #2
0
 public Item Atualizar(Item item)
 {
     if (item.Id <= 0)
     {
         throw new IdentificadorIndefinidoExcecao();
     }
     item.Validar();
     return(_repositorio.Atualizar(item));
 }