Exemplo n.º 1
0
 public async Task Create(LikesTipo model)
 {
     try
     {
         _db.bdSetLikesTipo.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
Exemplo n.º 2
0
        public async Task Update(LikesTipo model)
        {
            try
            {
                var _model = await _db.bdSetLikesTipo.FirstOrDefaultAsync(e => e.Id == model.Id);

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

            try
            {
                await _entityRepo.Update(model);

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