Esempio n. 1
0
 public List <Person> GetAllToDoUser()
 {
     try
     {
         using (var context = new ProjectManagementEntities())
         {
             var list = ToDoUserDB.GetInstance().GetAllToDoUser();
             return(list);
         }
     }
     catch (System.Exception exc)
     {
         throw exc;
     }
 }
Esempio n. 2
0
        public JsonResult SaveToDo(string _todoName, string _todoEndDate, int _projectId, List <int> _todoUsers)
        {
            try
            {
                var _personId = JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("ActivePerson")).Id;
                _todoUsers.Add(_personId);

                _todoUsers = _todoUsers.Distinct().ToList();

                var todo = new ToDo()
                {
                    Detail    = _todoName,
                    ProjectId = _projectId,
                    EndDate   = DateTime.ParseExact(_todoEndDate, "dd/MM/yyyy", null),
                    Status    = 1
                };

                var result = ToDoDB.GetInstance().SaveToDo(todo);

                foreach (var item in _todoUsers)
                {
                    var todouser = new ToDoUser()
                    {
                        ToDoId   = result.Id,
                        PersonId = item
                    };

                    ToDoUserDB.GetInstance().SaveToDoUser(todouser);
                }

                return(Json(result != null));
            }
            catch (System.Exception exc)
            {
                throw exc;
            }
        }