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)); } }
public ActionResult SaveDelete(Guid?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } _heroAppService.Remove(id.Value); return(RedirectToAction("Index")); } catch { return(View()); } }
// 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); } }