Exemplo n.º 1
0
 public ActionResult Delete(int id, SettingViewModel collection)
 {
     try
     {
         if (id > 0)
         {
             _settingService.Delete(_mapper.Map <Setting>(collection));
             return(RedirectToAction("Index"));
         }
         ModelState.AddModelError(string.Empty, GeneralMessages.EmptyId);
         return(View(collection));
     }
     catch (Exception ex)
     {
         _logger.Error(ex);
         if (ex.InnerException != null && ex.InnerException.Source.Equals(GeneralMessages.ExceptionSource))
         {
             ModelState.AddModelError(string.Empty, ex.Message);
         }
         else
         {
             ModelState.AddModelError(string.Empty, GeneralMessages.UnexpectedError);
         }
         return(View(collection));
     }
 }
Exemplo n.º 2
0
        public JsonResult Delete(int id)
        {
            var result = _settingService.Delete(new Language {
                Id = id
            });

            return(Json(result));
        }
Exemplo n.º 3
0
        public IActionResult DeleteConfirmed(int id)
        {
            Setting setting = _settingService.GetById(id);

            _settingService.Delete(setting);
            _settingService.Commit();
            return(RedirectToAction("Index"));
        }
 public IActionResult Delete(int id)
 {
     if (_settingService.GetById(id) == null)
     {
         return(NotFound());
     }
     return(Json(_settingService.Delete(id)));
 }
Exemplo n.º 5
0
        public JsonResult Delete(int Id)
        {
            var rs = _settingService.Delete(new Setting {
                Id = Id
            });

            return(Json(rs));
        }
Exemplo n.º 6
0
        public ActionResult Delete(int id)
        {
            var locale = _settingService.GetSetting(id);

            _settingService.Delete(locale);

            return(Json(
                       new { success = true }
                       , JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
        public HttpResponseMessage Delete(int id)
        {
            var setting = _settingService.GetSettingById(id);

            if (_settingService.Delete(setting))
            {
                return(PageHelper.toJson(PageHelper.ReturnValue(true, "数据删除成功")));
            }
            else
            {
                return(PageHelper.toJson(PageHelper.ReturnValue(false, "数据删除失败")));
            }
        }
Exemplo n.º 8
0
 public async Task <ActionResult> Delete(int id, SettingDto setting)
 {
     try
     {
         await _settingService.Delete(id);
     }
     catch (CustomException e)
     {
         ModelState.AddModelError(e.HttpCode.ToString(), e.CustomMessage);
         return(View());
     }
     return(RedirectToAction(nameof(Index)));
 }
Exemplo n.º 9
0
        public IHttpActionResult Delete(int id)
        {
            var setting = _settingService.Get(id);

            if (setting == null)
            {
                VerboseReporter.ReportError("Setting not found", "delete_setting");
                return(RespondFailure());
            }
            _settingService.Delete(setting);
            VerboseReporter.ReportSuccess("Setting deleted successfully", "delete_setting");
            return(RespondSuccess());
        }
Exemplo n.º 10
0
        public async Task <JsonResult> Remove(string id)
        {
            var model = await _settingService.FindById(id);

            if (model == null)
            {
                return(Json(new { IsCompleted = false, title = "Hata !", message = "Model Bulunamadı !" },
                            JsonRequestBehavior.AllowGet));
            }

            _settingService.Delete(model);

            return(Json(new { IsCompleted = true, title = "Başarılı !", message = "Başarı ile silindi !" },
                        JsonRequestBehavior.AllowGet));
        }
 public ActionResult Delete(int?id)
 {
     if (!id.HasValue)
     {
         return(Json(new { result = false }));
     }
     try
     {
         _settingService.Delete(id.Value);
         return(Json(new { result = true }));
     }
     catch (Exception)
     {
     }
     return(Json(new { result = false }));
 }
Exemplo n.º 12
0
        public ActionResult Delete(string name)
        {
            var setting = settingService.GetByName(name);

            if (setting == null)
            {
                this.NotifyError("Item not found.");
                return(RedirectToAction("List"));
            }

            var result = settingService.Delete(setting);

            if (result)
            {
                this.NotifySuccess("Successfully deleted.");
            }
            else
            {
                this.NotifyError("Item can not deleted!");
            }

            return(RedirectToAction("List"));
        }
Exemplo n.º 13
0
        public JsonResult DeleteAppSetting(int id)
        {
            var item = _settingService.Get(id);

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

            var itemName     = item.Name + "|" + item.Value;
            var confirmation = _settingService.Delete(item.Id);

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

            return(Json(new { status = confirmation.WasSuccessful, message = confirmation.Message }));
        }
Exemplo n.º 14
0
        public ActionResult Delete(int settingId)
        {
            _settingService.Delete(settingId);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 15
0
        public async Task <BaseResult> Delete(int id)
        {
            var result = await _settingService.Delete(id);

            return(result);
        }
 public IHttpActionResult Delete(long id)
 {
     settingService.Delete(id);
     return(Ok());
 }
        public JsonResult Delete(string resourceName)
        {
            var result = _settingService.Delete(resourceName);

            return(Json(result));
        }
Exemplo n.º 18
0
 public void Delete(Setting setting)
 {
     _settingService.Delete(setting);
 }