Beispiel #1
0
 public async Task Create(UbicacionAreas model)
 {
     try
     {
         _db.dbSetUbicacion.Add(model);
         await _db.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
Beispiel #2
0
        public async Task Update(UbicacionAreas model)
        {
            try
            {
                var _model = await _db.dbSetUbicacion.FirstOrDefaultAsync(e => e.UbicacionAreaId == model.UbicacionAreaId);

                if (_model != null)
                {
                    _db.Entry(_model).CurrentValues.SetValues(model);
                    await _db.SaveChangesAsync();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
Beispiel #3
0
        public async Task UpdateEstado(UbicacionAreas obj)
        {
            try
            {
                var _obj = await _db.dbSetUbicacion.FirstOrDefaultAsync(e => e.UbicacionAreaId == obj.UbicacionAreaId);

                if (_obj != null)
                {
                    _obj.Estado = obj.Estado;

                    await _db.SaveChangesAsync();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
Beispiel #4
0
                                                            public async Task <IHttpActionResult> UpdateEstado(UbicacionAreas obj)
                                                            {
                                                                try { log.Info(new MDCSet(this.ControllerContext.RouteData));
                                                                      await _repository.UpdateEstado(obj);

                                                                      return(Ok("Registro actualizado correctamente!")); }
                                                                catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e);

                                                                                      return(InternalServerError(e)); }
                                                            }
Beispiel #5
0
                                                            [HttpPost][Authorize] public async Task <IHttpActionResult> Create(UbicacionAreas obj)
                                                            {
                                                                try { log.Info(new MDCSet(this.ControllerContext.RouteData));
                                                                      await _repository.Create(obj);

                                                                      return(Ok("Ubicación creada correctamente!")); }
                                                                catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e);

                                                                                      return(InternalServerError(e)); }
                                                            }