Exemplo n.º 1
0
        public ActionResult Edit(int?id)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (id == null)
            {
                return(RedirectToAction("Index"));
            }
            Product      product     = ProductServices.Get(id.Value, db);
            Request      request     = RequestServices.Get(id.Value, db);
            GrantRequest loanRequest = GrantRequestServices.Get(id.Value, db);

            if (product == null || request == null || loanRequest == null)
            {
                return(HttpNotFound());
            }

            // For Product
            ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "Id_Name", product.Employee);

            //For Grant
            ViewBag.GrantTypeList = new SelectList(GrantTypeServices.List(db), "Id", "Name");

            GrantRequestViewModel vm = new GrantRequestViewModel();

            vm.RequestProduct = product;
            vm.Request        = request;
            vm.GrantRequest   = loanRequest;

            return(View(vm));
        }
Exemplo n.º 2
0
        // GET: GrantRequest/Delete/5
        public ActionResult Delete(Nullable <int> id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Db           db           = new Db(DbServices.ConnectionString);
            GrantRequest grantRequest = GrantRequestServices.Get(id.Value, db);

            if (grantRequest == null)
            {
                return(HttpNotFound());
            }
            return(View(grantRequest));
        }
Exemplo n.º 3
0
        // GET: GrantRequest/Edit/5
        public ActionResult Edit(Nullable <int> request)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (request == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GrantRequest grantRequest = GrantRequestServices.Get(request.Value, db);

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

            ViewBag.GrantTypeList = new SelectList(GrantTypeServices.List(db), "Id", "Name", grantRequest.GrantType);
            ViewBag.RequestList   = new SelectList(RequestServices.List(db), "Product", "Attachment", grantRequest.Request);
            return(View(grantRequest));
        }