public JsonResult Delete(int id)
        {
            var target = _feedbackService.Delete(id);

            _feedbackService.Save();
            return(Json(new
            {
                message = ResultState.Delete_SUCCESS
            }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
 public async Task <IActionResult> Delete(int feedbackId)
 {
     if (await _feedbackService.Delete(feedbackId))
     {
         return(Ok());
     }
     return(BadRequest("False"));
 }
示例#3
0
 public IActionResult Delete(int id)
 {
     if (!ModelState.IsValid)
     {
         return(new BadRequestObjectResult(ModelState));
     }
     _feedbackService.Delete(id);
     _feedbackService.SaveChanges();
     return(new OkObjectResult(id));
 }
        public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    var oldFeedback = _feedbackService.Delete(id);
                    _feedbackService.Save();

                    var responseData = Mapper.Map <Feedback, FeedbackViewModel>(oldFeedback);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }

                return response;
            }));
        }
        public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    //trả về lỗi để bên ngoài bắt được sự kiện lỗi này
                    response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    var oldProduct = _feedbackService.Delete(id); //xoá dữ liệu cũ

                    _feedbackService.Save();

                    var responseData = Mapper.Map <Feedback, FeedbackViewModel>(oldProduct);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }

                return response;
            }));
        }
示例#6
0
        public ActionResult DeleteFeedback(int id)
        {
            var feedback = feedbackService.GetById(id);

            if (feedback != null && feedback.ProviderProfileId == User.Identity.GetUserId())
            {
                var idOrder = feedback.OrderId;

                feedbackService.Delete(id);

                var order = orderService.GetById(idOrder);
                order.OrderStatus       = OrderStatus.Active;
                order.ProviderProfileId = null;
                orderService.Update(order);

                return(RedirectToAction($"Details/{idOrder}"));
            }

            return(HttpNotFound());
        }
示例#7
0
        public ActionResult Delete(Guid feedbackId)
        {
            var result = new DataJsonResult();

            Models.Feedback feedback = _currencyService.GetSingleById <Models.Feedback>(feedbackId);

            if (feedback != null)
            {
                var isDelete = _feedbackService.Delete(feedback);

                if (!isDelete)
                {
                    result.ErrorMessage = "删除失败!";
                }
            }
            else
            {
                result.ErrorMessage = "反馈不存在!";
            }

            return(Json(result));
        }
 public ActionResult Delete(Guid id)
 {
     feedbackService.Delete(id);
     return(RedirectToAction("Index"));
 }