Inheritance: IAuditable
Esempio n. 1
0
 /// <summary>
 /// Creates SelectLists for Foreign-keys
 /// </summary>
 private void LoadSelectLists(Need need)
 {
     var categories = Model.New<Category>().GetAll().ToList();
     ViewData["Categories"] = new SelectList(categories, "ID", "Name", need.CategoryID);
 }
Esempio n. 2
0
        public ActionResult Create(Need need)
        {
            if (ModelState.IsValid) {
                try {
                    need.SubmittedByID = CurrentUser.ID;
                    need.ChurchID = CurrentUser.ChurchID;
                    need.NeedStatusID = (int)NeedStatusEnum.Pending;
                    need.Save();

                    return RedirectToAction("Index");
                }
                catch (Exception ex) {
                    // put exception somewhere on screen or redirect
                    throw (ex);
                }
            }

            // Unsuccessful, so load the necessary data for the form and show it again
            LoadSelectLists(need);
            return View("New", need);
        }