Пример #1
0
        public ActionResult AddVoucher([Bind(Include = "user,subcription,Used,ExpiryDate")] Voucher voucher)
        {
            DataBank db = new DataBank();

            voucher.user        = db.GetUser(Convert.ToInt32(Session["VoucherUserId"]));
            voucher.subcription = db.GetSubcription(Convert.ToInt32(Session["VoucherSubscriptionId"]));
            voucher.Date        = DateTime.Now;
            if (db.AddVoucher(voucher))
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }
 public ActionResult Create([Bind(Include = "ID,Name,ActivationFee,subcriptionId")] ResourceModelView resource)
 {
     if (ModelState.IsValid)
     {
         DataBank db       = new DataBank();
         var      res      = db.GetSubcription(resource.subcriptionId);
         var      finalRes = new Resource()
         {
             ActivationFee = resource.ActivationFee, Name = resource.Name, subcription = res
         };
         db.CreateResource(finalRes);
         return(RedirectToAction("Index"));
     }
     return(View(resource));
 }
        public ActionResult EditCreditPool(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DataBank    db          = new DataBank();
            Subcription subcription = db.GetSubcription(id);

            if (subcription == null)
            {
                return(HttpNotFound());
            }
            return(View(subcription));
        }
Пример #4
0
        public ActionResult Create([Bind(Include = "ID,Title,Content,Prority,Done,CreatedDate,DueDate")] ToDoList toDoList)
        {
            MethodBank mb     = new MethodBank();
            int        userId = Convert.ToInt32(Session["UserID"]);
            int        subId  = Convert.ToInt32(Session["SubcriptionId"]);
            int        resId  = Convert.ToInt32(Session["ResId"]);

            if (mb.UseResource(userId, subId, resId))
            {
                DataBank db = new DataBank();
                toDoList.Done                 = false;
                toDoList.CreatedDate          = DateTime.Now;
                toDoList.Resource             = db.GetResource(resId);
                toDoList.Resource.subcription = db.GetSubcription(subId);
                if (db.CreateToDoListItem(toDoList))
                {
                    return(RedirectToAction("Index"));
                }
            }
            ViewBag.CreditBalance = mb.GetUserUsageBalance(subId, userId);
            return(View(toDoList));
        }