Example #1
0
 public async Task Create(ProductoGIEvaluadores model)
 {
     try
     {
         dbGI.DbSetProductoGIEvaluadores.Add(model);
         await dbGI.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
Example #2
0
        public async Task Update(ProductoGIEvaluadores model)
        {
            try
            {
                var _model = await dbGI.DbSetProductoGIEvaluadores.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);
            }
        }
        public async Task <IHttpActionResult> Update([FromBody] ProductoGIEvaluadores model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                await _repo.Update(model);

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