示例#1
0
 public JsonResult Delete(Guid id)
 {
     try
     {
         _heroAppService.Remove(id);
         return(Json(new { success = true }));
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, message = "Error" }));
     }
 }
 public ActionResult Delete(Storm.Business.ViewModels.HeroViewModel model, FormCollection f)
 {
     try
     {
         model.HeroId = ObjectId.Parse(ConvertStringArrayToString((string[])f.GetValue("HeroId").RawValue));
         _heroAppService.Remove(model.HeroId);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError(string.Empty, ex.Message);
         return(View(model));
     }
 }
示例#3
0
        public ActionResult SaveDelete(Guid?id)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                _heroAppService.Remove(id.Value);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#4
0
        // DELETE: api/Hero/5
        public HttpStatusCode Delete(string id)
        {
            var model = _heroAppService.GetById(ObjectId.Parse(id));

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

            try
            {
                _heroAppService.Remove(ObjectId.Parse(id));
                return(HttpStatusCode.OK);
            }
            catch
            {
                return(HttpStatusCode.InternalServerError);
            }
        }