// Create a task
        public ActionResult CreateTask()
        {
            if (!(User.Identity.IsAuthenticated && User.Identity.Name == "admin"))
            {
                return(RedirectToAction("Index", "Home"));
            }
            try
            {
                if (Request.Form["save"] != null)
                {
                    DateTime start = DateTime.Now;
                    if (Request.Form["start"] != "")
                    {
                        start = DateTime.Parse(Request.Form["start"]);
                    }
                    DateTime end = DateTime.Now;
                    if (Request.Form["end"] != "")
                    {
                        end = DateTime.Parse(Request.Form["end"]);
                    }
                    string   values  = Request.Form["users"];
                    string[] userIds = values.Split(',');

                    TasksDAL.CreateTask(Request.Form["taskName"], Request.Form["description"], start,
                                        end, int.Parse(Request.Form["estimation"]), Request.Form["status"], userIds);
                }
                return(RedirectToAction("Task", "Admin"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
예제 #2
0
 public static void CreateTask(TodoTask task)
 {
     task.CreatedDate = DateTime.Now;
     task.Status      = TodoTaskStatus.New;
     TasksDAL.CreateTask(task);
 }
예제 #3
0
 public static int CreateTask(TasksDTO task, List <int> arrUser, int ownerId)
 {
     return(TasksDAL.CreateTask(task, arrUser, ownerId));
 }