public IActionResult Delete(Model model)
        {
            var result = _modelService.Delete(model);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
        public JsonResult PicDelete(long productID, long picID)
        {
            JsonResult result = new JsonResult {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };

            if (picID == 0)
            {
                return(result);
            }
            else
            {
                ProductPicture _PicModel = svc.SelectOrEmpty(
                    new ProductPictureQuery()
                {
                    IDs = new long[] { picID }
                }).FirstOrDefault();
                if (_PicModel != null)
                {
                    _pictureService.Delete(_PicModel);
                    svc.Delete(_PicModel);
                    result.Data = new { Success = true };
                }
                else
                {
                    result.Data = new { Success = false };
                }
                return(result);
            }
        }
Beispiel #3
0
        public async Task <ActionResult> Delete(ModelInsertViewModel viewModel)
        {
            Response response = new Response();

            var configuration = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <ModelInsertViewModel, ModelDTO>();
            });

            IMapper mapper = configuration.CreateMapper();

            ModelDTO dto = mapper.Map <ModelDTO>(viewModel);

            response = await _service.Delete(dto.ID);

            //Se funcionou, redireciona pra página inicial
            if (response.Success)
            {
                return(RedirectToAction("Index", "Model"));
            }
            else
            {
                ViewBag.ErrorMessage = response.Errors;
                return(this.View());
            }
        }
Beispiel #4
0
        /// <summary>
        /// 删除一条已存在的车辆信息
        /// </summary>
        /// <returns></returns>
        public ActionResult DeleteVehicle()
        {
            string license = Request["License"];

            try
            {
                if (modelService.Delete(license))
                {
                    Response.Write("<script>");
                    Response.Write("alert('删除成功')");
                    Response.Write("</script>");
                }
                else
                {
                    Response.Write("<script>");
                    Response.Write("alert('删除失败,请检查您的输入')");
                    Response.Write("</script>");
                }
            }
            catch (Exception)
            {
                Response.Write("<script>");
                Response.Write("alert('出现异常,请联系开发者(QQ: 2788636917)')");
                Response.Write("</script>");
            }

            return(View("VehicleManage"));
        }
Beispiel #5
0
 public JsonResult DeleteTextReply(TextReplyItem reply)
 {
     svc.Delete(reply);
     return(new JsonResult()
     {
         JsonRequestBehavior = JsonRequestBehavior.AllowGet,
         Data = new { success = true }
     });
 }
        // Overrides for performing the specific actions for the controller

        protected virtual ActionResult OnDelete(TEntity entity, string returnTo)
        {
            service.Delete(entity);
            if (String.IsNullOrEmpty(returnTo))
            {
                return(RedirectToAction("list"));
            }
            return(Redirect(returnTo));
        }
Beispiel #7
0
        public async Task <IActionResult> DeleteModel(int idModel)
        {
            ServiceResponse <List <Model> > response = await _modelService.Delete(idModel);

            if (response.Data == null)
            {
                return(NotFound(response));
            }
            return(Ok(response));
        }
        public async Task <IActionResult> DeleteModel(int id)
        {
            var result = await _modelService.Delete(id);

            if (result)
            {
                return(Ok());
            }

            return(NotFound());
        }
        public IActionResult Delete(int id)
        {
            var result = _modelService.Delete(id);

            if (!result.IsSuccees)
            {
                return(BadRequest(result));
            }

            return(Ok(result));
        }
        public IActionResult Delete(long id)
        {
            var modelToDelete = _modelService.Get(id);

            if (modelToDelete is null)
            {
                return(NotFound());
            }
            _modelService.Delete(modelToDelete);
            return(NoContent());
        }
Beispiel #11
0
        /// <summary>
        /// 删除指定id的雇员信息
        /// </summary>
        /// <returns></returns>
        public ActionResult Delete()
        {
            string id = Request["Emp_Id"];

            if (modelService.Delete(id))
            {
                Response.Write("<script>alert('删除成功!')</script>");
            }
            else
            {
                Response.Write("<script>alert('删除失败! 请联系开发者(QQ: 2788636917)')</script>");
            }

            return(View("DeleteEmployee"));
        }
Beispiel #12
0
        public async Task <IActionResult> Delete(int id)
        {
            if (id == 0)
            {
                return(BadRequest());
            }

            var model = await _service.GetById(id);

            if (model == null)
            {
                return(NotFound());
            }

            await _service.Delete(model);

            return(NoContent());
        }
Beispiel #13
0
        public async Task <HttpResponseMessage> Delete(Guid id)
        {
            try
            {
                var response = await ModelService.Delete(id);

                if (response == 0)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Couldn't delete model."));
                }

                return(Request.CreateResponse(HttpStatusCode.OK, response));
            }
            catch
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Couldn't delete data. Database error."));
            }
        }
Beispiel #14
0
 // Removes a record from table Models.
 public IActionResult Delete(int?id)
 {
     try
     {
         if (id.HasValue)
         {
             modelService.Delete(id);
             return(RedirectToAction("Index", "Model"));
         }
         else
         {
             return(BadRequest("The ID isn't valid"));
         }
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
Beispiel #15
0
        public ActionResult PicDelete(long picID)
        {
            JsonResult result = new JsonResult {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };

            try
            {
                //删除物理文件
                BannerPicture _PicModel = svc.SelectOrEmpty(new BannerPictureQuery()
                {
                    IDs = new long[] { picID }
                }).FirstOrDefault();
                _pictureService.Delete(_PicModel);

                //删除数据库记录
                svc.Delete(new BannerPicture()
                {
                    ID = picID
                });

                result.Data =
                    new
                {
                    Success = true
                };

                return(result);
            }
            catch (Exception e)
            {
                result.Data =
                    new
                {
                    Success = false,
                    Message = e.Message
                };

                return(result);
            }
        }
Beispiel #16
0
 public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     // MessageBox.Show(e.Item.Caption);
     //新增
     if (e.Item.Caption == BtnCommandEnum.Add)
     {
         eRPM003ModelBindingSource.AddNew();
         EditForm("模具资料新增", BtnCommandEnum.Add);
     }
     else if (e.Item.Caption == BtnCommandEnum.Edit)
     {
         EditForm("模具资料修改", BtnCommandEnum.Edit);
     }
     else if (e.Item.Caption == BtnCommandEnum.Delete)
     {
         if (ERPHelper.Instance.MessageDel())
         {
             var temp = eRPM003ModelBindingSource.Current as ERP_M003_Model;
             modelService.Delete(temp.Id);
             eRPM003ModelBindingSource.RemoveCurrent();
         }
     }
 }
Beispiel #17
0
 public void Delete(Guid id)
 {
     _modelService.Delete(id);
 }
        public async Task <IActionResult> Delete(int id)
        {
            var result = await _ModelService.Delete(id);

            return(Ok(result));
        }
Beispiel #19
0
 public void Delete(string objectI, string modelC)
 {
     _modelService.Delete(objectI, modelC);
 }
Beispiel #20
0
        private void DeleteAddress(Guid addressId)
        {
            var address = _addressService.Get(addressId);

            _addressService.Delete(address);
        }
Beispiel #21
0
        private void DeleteCompany(Guid companyId)
        {
            var company = _companyService.Get(companyId);

            _companyService.Delete(company);
        }
Beispiel #22
0
        public void DeleteVocationalQualificationUnit(Guid Id)
        {
            var vocationalQualificationUnit = _vocationalQualificationUnitService.Get(Id);

            _vocationalQualificationUnitService.Delete(vocationalQualificationUnit);
        }
Beispiel #23
0
        public void DeleteTeacher(Guid Id)
        {
            var teacher = _teacherService.Get(Id);

            _teacherService.Delete(teacher);
        }
Beispiel #24
0
        public IActionResult Delete(int id)
        {
            var response = _service.Delete(id);

            return(Ok(response));
        }