public ActionResult Create(Target target) { try { RavenSession.Store(target); RavenSession.SaveChanges(); SetMessage("Target saved"); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Edit(string id, Target target) { try { string fullId = "targets/" + id; var dbTarget = RavenSession.Load<Target>(fullId); dbTarget.Name = target.Name; dbTarget.Amount = target.Amount; dbTarget.MoreInfoLink = target.MoreInfoLink; dbTarget.Description = target.Description; RavenSession.SaveChanges(); SetMessage("Target updated successfully"); return RedirectToAction("Index"); } catch { return View(); } }