public ActionResult General(AdminGeneralSettingsViewModel model) { if (ModelState.IsValid) { Project defaultProject = _db.Projects.Single(p => p.Name == "DefaultProject"); defaultProject.ProjectNumber = model.ProjectNumber; _db.Projects.Attach(defaultProject); _db.Entry(defaultProject).State = EntityState.Modified; _db.SaveChanges(); ViewBag.AppMessage = new AppMessage() { Type = AppMessage.Success, Message = AppString.ChangesSaved }; } else { ViewBag.AppMessage = new AppMessage() { Type = AppMessage.Error, Message = AppString.ErrorFormNotFilledCorrectly } }; return(View(model)); }
// GET: Admin public ActionResult General() { Project defaultProject = _db.Projects.Single(p => p.Name == "DefaultProject"); AdminGeneralSettingsViewModel model = new AdminGeneralSettingsViewModel() { ProjectNumber = defaultProject.ProjectNumber }; return(View(model)); }