Exemple #1
0
        public ActionResult Create(TaskViewModel task)
        {
            Task newTask = new Task
            {
                TaskText    = EscapeHtml(task.TaskText),
                Title       = EscapeHtml(task.Title),
                Added       = DateTime.Now,
                Author      = WebSecurity.CurrentUserId,
                UserProfile = data.FindUser(WebSecurity.CurrentUserId)
            };

            var categoryNames = JsonConvert.DeserializeObject <List <string> >(JsonConvert.DeserializeObject <string>(task.Categories));

            foreach (string s in categoryNames)
            {
                data.AddCategory(s);
                newTask.Categories.Add(data.GetCategory(s));
            }
            var solutions = task.Answers.Split(',');

            foreach (var solution in solutions)
            {
                data.AddAnsver(solution);
            }
            data.modifiUserProfileSuccess();
            data.AddTask(newTask);
            return(RedirectToAction("Index", "Home"));
        }
Exemple #2
0
        public IActionResult Summary(bool created, long id)
        {
            Product model = DataAccessModel.GetProduct(id);

            ViewData["Category"] = DataAccessModel.GetCategory(model.CategoryId);
            ViewData["Created"]  = created;
            return(View(model));
        }
 public IActionResult Category(int id)
 {
     ViewData["Category"] = DataAccessModel.GetCategory(id);
     return(View(DataAccessModel.GetProducts(id)));
 }