Пример #1
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));
        }