示例#1
0
 public async Task Create(PlanNegocioEvolAutores model)
 {
     try
     {
         dbGI.DbSetPlanNegocioEvolAutores.Add(model);
         await dbGI.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
示例#2
0
        public async Task Update(PlanNegocioEvolAutores model)
        {
            try
            {
                var _model = await dbGI.DbSetPlanNegocioEvolAutores.FirstOrDefaultAsync(e => e.Id == model.Id);

                if (_model != null)
                {
                    dbGI.Entry(_model).CurrentValues.SetValues(model);
                    await dbGI.SaveChangesAsync();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
示例#3
0
        public async Task <IHttpActionResult> Update([FromBody] PlanNegocioEvolAutores model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                await _repo.Update(model);

                return(Ok("Registro actualizado exitosamente!"));
            }
            catch (Exception e)
            {
                return(InternalServerError(e));
            }
        }