Esempio n. 1
0
 public IActionResult Delete(long id)
 {
     _deleteService.Delete(new ToggleRequest()
     {
         Id = id
     });
     return(new NoContentResult());
 }
Esempio n. 2
0
 public IActionResult Delete(string application, long toggleId)
 {
     _deleteService.Delete(new AppOverrideRequest()
     {
         ToggleId = toggleId, Application = application
     });
     return(new NoContentResult());
 }
        public ActionResult Delete(int id, IDeleteService service)
        {
            var response = service.Delete<Blog>(id);
            if (response.IsValid)
                TempData["message"] = response.SuccessMessage;
            //else it throws a concurrecy error, which shows the default error page.

            return RedirectToAction("Index");
        }
        public ActionResult Delete(int id, IDeleteService service)
        {
            var response = service.Delete<Tag>(id);
            if (response.IsValid)
                TempData["message"] = response.SuccessMessage;
            else
                //else errors, so send back an error message
                TempData["errorMessage"] = new MvcHtmlString(response.ErrorsAsHtml());

            return RedirectToAction("Index");
        }
        public ActionResult DeleteSalesOrder(int salesOrderId, IDeleteService service)
        {
            var response = service.Delete<SalesOrderHeader>(salesOrderId);
            if (response.IsValid)
                return Json(new { SuccessMessage = response.SuccessMessage });

            //else errors, so copy the errors over to the ModelState
            response.CopyErrorsToModelState(ModelState);

            return Json(ModelState.ToDataSourceResult());
        }
Esempio n. 6
0
        public ActionResult Delete(int id, IDeleteService service)
        {
            var response = service.Delete <Blog>(id);

            if (response.IsValid)
            {
                TempData["message"] = response.SuccessMessage;
            }
            //else it throws a concurrecy error, which shows the default error page.

            return(RedirectToAction("Index"));
        }
        public ActionResult CustomerDelete(int customerId, IDeleteService service)
        {
            var response = service.Delete <Customer>(customerId);

            if (response.IsValid)
            {
                return(Json(new { SuccessMessage = response.SuccessMessage }));
            }

            //else errors, so copy the errors over to the ModelState
            response.CopyErrorsToModelState(ModelState);

            return(Json(ModelState.ToDataSourceResult()));
        }
Esempio n. 8
0
        public ActionResult Delete(int id, IDeleteService service)
        {
            var response = service.Delete <Post>(id);

            if (response.IsValid)
            {
                TempData["message"] = response.SuccessMessage;
            }
            else
            {
                //else errors, so send back an error message
                TempData["errorMessage"] = new MvcHtmlString(response.ErrorsAsHtml());
            }

            return(RedirectToAction("Index"));
        }
        /// <summary>
        /// 尝试删除下游单据,返回删除结果
        /// </summary>
        /// <param name="tableNumber">下游单据表格编码</param>
        /// <param name="entityIds">下游单据体内码</param>
        /// <returns></returns>
        private IOperationResult DeleteTargetBill(
            string tableNumber, HashSet <long> entityIds)
        {
            IBusinessFlowService bfService   = ServiceHelper.GetService <IBusinessFlowService>();
            TableDefine          tableDefine = bfService.LoadTableDefine(this.Context, tableNumber);

            // 读取下游单据的元数据
            IMetaDataService metaService = ServiceHelper.GetService <IMetaDataService>();
            FormMetadata     meta        = metaService.Load(
                this.Context, tableDefine.FormId) as FormMetadata;

            // 根据下游单据体的内码,读取单据内码
            HashSet <long> billIds = this.LoadTargetBillIds(meta.BusinessInfo, tableDefine.EntityKey, entityIds);

            object[] pkValues = (from p in billIds select(object) p).ToArray();
            // 调用删除服务,删除单据
            IDeleteService   deleteService = ServiceHelper.GetService <IDeleteService>();
            IOperationResult deleteResult  = deleteService.Delete(this.Context, meta.BusinessInfo,
                                                                  pkValues, this.Option);

            return(deleteResult);
        }
Esempio n. 10
0
        public Task Delete(Guid userId)
        {
            var sql = $"DELETE FROM \"{_tableName}\" WHERE \"Id\" = @userId";

            return(_userDeleteService.Delete(sql, new { userId }));
        }