public void Update(PlanoEdicaoModel model)
        {
            var plano = new Plano();

            plano.Id        = model.Id;
            plano.Nome      = model.Nome;
            plano.Sigla     = model.Sigla;
            plano.Descricao = model.Descricao;

            planoDomainService.Update(plano);
        }
Пример #2
0
 public IActionResult Put(PlanoEdicaoModel model,
                          [FromServices] IPlanoApplicationService planoApplicationService)
 {
     try
     {
         planoApplicationService.Update(model);
         return(Ok("Plano Alterado com sucesso."));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Пример #3
0
 public IActionResult Put(PlanoEdicaoModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             service.Atualizar(model);
             var result = new
             {
                 message = "Plano atualizado com sucesso"
             };
             return(Ok(result));
         }
         catch (Exception e)
         {
             return(StatusCode(500, e.Message));
         }
     }
     else
     {
         return(BadRequest()); //HTTP 400
     }
 }
Пример #4
0
        public void Atualizar(PlanoEdicaoModel model)
        {
            var plano = Mapper.Map <PlanoEntity>(model);

            domainService.Atualizar(plano);
        }