Esempio n. 1
0
        public ActionResult CreateHomework(HomeworkVM vm)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    homeworkService.CreateHomework((int)Session["SessionUserId"], vm.Name, vm.Description, vm.Deadline, Server.MapPath(ConfigurationManager.AppSettings["BasePath"]));

                    return(RedirectToAction("Index"));
                }
                catch (Exception)
                {
                    return(View("Error", (object)"Invalid credentials"));
                }
            }
            else
            {
                return(View("Error", (object)"Invalid data!"));
            }
        }