Beispiel #1
0
        public ActionResult Create(VMBorrower data)
        {
            try
            {
                // context on outside because both sides of modelstate
                // need context (then needs to update, and else needs to repopulate)

                using (Context ctx = new Context())
                {
                    if (ModelState.IsValid)
                    {
                        ctx.BorrowerCreate(data);
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        data.PopulateRoleItems(ctx.RoleGetAll());
                        return(View(data));
                    }
                }
            }
            catch (Exception ex)
            {
                return(View("Exception", ex));
            }
        }
Beispiel #2
0
 // GET: Borrower/Create
 public ActionResult Create()
 {
     try
     {
         using (Context ctx = new Context())
         {
             var data = new VMBorrower();
             data.PopulateRoleItems(ctx.RoleGetAll());
             return(View(data));
         }
     }
     catch (Exception ex)
     {
         return(View("Exception", ex));
     }
 }