예제 #1
0
        public ActionConfirmation DeleteJefeArea(Guid id)
        {
            var item = _jefeAreaRepository.Get(id);

            if (item == null)
            {
                return(ActionConfirmation.CreateFailure("item no existe"));
            }

            try
            {
                if (item.Locales.Any())
                {
                    foreach (var local in item.Locales)
                    {
                        _localService.Delete(local.Id);
                    }
                }

                _jefeAreaRepository.Delete(item.Id);
                _jefeAreaRepository.DbContext.CommitChanges();

                return(ActionConfirmation.CreateSuccess("Delete OK (" + item.Nombre + ")"));
            }
            catch (Exception exception)
            {
                _eventLogService.AddException(exception.Message,
                                              exception.StackTrace, EventCategory.EliminarObjeto.ToString(), exception, item.ActualizadoPor, EventSource.Sistema);

                return(ActionConfirmation.CreateFailure(exception.ToString()));
            }
        }
예제 #2
0
        public ActionResult Delete(int id)
        {
            bool rpta = localservice.Delete(id);

            if (rpta)
            {
                return(RedirectToAction("Index"));
            }

            return(View());
        }
예제 #3
0
        public JsonResult Delete(Guid id)
        {
            var item = _localService.Get(id);

            if (item == null)
            {
                return(Json(false));
            }

            var itemName     = item.Nombre + "|";
            var confirmation = _localService.Delete(item.Id);

            if (confirmation.WasSuccessful)
            {
                LogSaveObjectAction(savedObject: $"{itemName} deleted");
            }
            else
            {
                LogErrorObjectAction(confirmation.Message, $"{itemName}");
            }

            return(Json(new { status = confirmation.WasSuccessful, message = confirmation.Message }));
        }
예제 #4
0
 public void Delete(Guid id)
 {
     _localService.Delete(id);
 }
예제 #5
0
 public IHttpActionResult Delete(int localId)
 {
     _localService.Delete(localId);
     return(Ok());
 }
예제 #6
0
 public IActionResult Delete(Guid LocalId)
 {
     Service.Delete(LocalId);
     return(Ok(true));
 }