public async Task <ActionResult> Delete(int id, libraryNaturguiden.News model) { try { await NewsHandler.DeleteNewsAsync(id); return(RedirectToAction("Index")); } catch (Exception e) { ViewBag.Error = e.Message; return(View(model)); } }
public async Task <ActionResult> Edit(int id, libraryNaturguiden.News model) { if (ModelState.IsValid) { try { var status = await NewsHandler.UpdateNewsAsync(model); return(RedirectToAction("Index")); } catch (Exception e) { ViewBag.Error = e.Message; return(View(model)); } } ViewBag.Error = "One or more fields was not filled in correctley"; return(View(model)); }