public ActionResult ConfirmDelete(Guid id) { var versions = new Versions(); var apps = new Apps(); var groups = new Groups(); var version = versions.GetVersion(id); var app = apps.GetApp(version.AppKey); var group = groups.GetGroup(app.GroupKey); var model = new VersionDetails() { Version = version, App = app, Group = group, }; return View(model); }
public ActionResult Create(Guid aid) { var apps = new Apps(); var groups = new Groups(); var app = apps.GetApp(aid); var group = groups.GetGroup(app.GroupKey); var version = new Version() { AppKey = aid, GroupKey = group.Key, VersionNumber = string.Format("{0}.{1}", app.MajorVersion, app.Revision) }; var model = new VersionDetails() { Version = version, App = app, Group = group, }; return View(model); }
public ActionResult Create(Guid aid, string comment, DateTime timestamp) { var apps = new Apps(); var app = apps.GetApp(aid); var newVersion = new Version() { AppKey = aid, Comment = comment, Timestamp = timestamp, VersionNumber = string.Format("{0}.{1}", app.MajorVersion, app.Revision), }; if (string.IsNullOrWhiteSpace(comment)) ModelState.AddModelError("comment", "Comment is required."); if (ModelState.IsValid) { try { var versions = new Versions(); versions.CreateVersion(newVersion); app.Revision += 1; apps.UpdateApp(app); return RedirectToAction("Details", new { id = newVersion.Key }); } catch (Exception ex) { ModelState.AddModelError("Error", ex); } } var groups = new Groups(); var group = groups.GetGroup(app.GroupKey); var model = new VersionDetails() { Version = newVersion, App = app, Group = group, }; return View(model); }
public ActionResult Edit(Guid id, string comment) { Version version = null; try { var versions = new Versions(); version = versions.GetVersion(id); version.Comment = comment; versions.UpdateVersion(version); return RedirectToAction("Details", new { id = version.Key }); } catch (Exception ex) { ModelState.AddModelError("Error", ex); } var groups = new Groups(); var apps = new Apps(); Group group = null; App app = null; if (version != null) { group = groups.GetGroup(version.GroupKey); app = apps.GetApp(version.AppKey); } var model = new VersionDetails() { Version = version, App = app, Group = group, }; return View(model); }
public ActionResult Delete(Guid id) { var versions = new Versions(); var version = versions.GetVersion(id); try { versions.DeleteVersion(id); return RedirectToAction("Index", new { aid = version.AppKey }); } catch (Exception ex) { ModelState.AddModelError("Error", ex.Message); var apps = new Apps(); var app = apps.GetApp(version.AppKey); var groups = new Groups(); var group = groups.GetGroup(version.GroupKey); var model = new VersionDetails() { Version = version, App = app, Group = group, }; return View("ConfirmDelete", model); } }