Exemple #1
0
        public async Task <IActionResult> DeleteReference(RefViewMode model)
        {
            if (ModelState.IsValid)
            {
                if (model.ActiveStatus == true)
                {
                    ModelState.AddModelError("", $"不能删除正在使用中的{model.Type}, 请首先停用它");
                }
                else
                {
                    try
                    {
                        await _sysAdminSvc.DeleteReference(model.ID);

                        return(RedirectToAction(nameof(References), new { t = RefViewMode.Parse(model.Type) }));
                    }
                    catch (Exception ex)
                    {
                        ModelState.AddModelError("", "删除参照项失败:" + ex.Message);
                    }
                }
            }
            return(View(nameof(EditReference), model));
        }