コード例 #1
0
        public ActionResult Create()
        {
            Db db = new Db(DbServices.ConnectionString);

            ViewBag.GrantRequestList = new SelectList(GrantRequestServices.List(db), "Request", "Description");
            return(View());
        }
コード例 #2
0
        public ActionResult Create([Bind(Include = "GrantRequest, AverageIncome, GrantPercentage, ServiceInMonthes")] ServiceEndGrantRequest serviceEndGrantRequest)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    ServiceEndGrantRequestServices.Insert(CurrentUser.Id, serviceEndGrantRequest, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed");
                    return(RedirectToAction("Index"));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
            }

            ViewBag.GrantRequestList = new SelectList(GrantRequestServices.List(db), "Request", "Description");
            return(View(serviceEndGrantRequest));
        }
コード例 #3
0
        // GET: ServiceEndGrantRequest/Edit/5
        public ActionResult Edit(Nullable <int> grantRequest)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (grantRequest == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ServiceEndGrantRequest serviceEndGrantRequest = ServiceEndGrantRequestServices.Get(grantRequest.Value, db);

            if (serviceEndGrantRequest == null)
            {
                return(HttpNotFound());
            }

            ViewBag.GrantRequestList = new SelectList(GrantRequestServices.List(db), "Request", "Description", serviceEndGrantRequest.GrantRequest);
            return(View(serviceEndGrantRequest));
        }