Exemplo n.º 1
0
 public JsonResult DeleteToDo(int _todoId)
 {
     try
     {
         var result = ToDoDB.GetInstance().DeleteToDo(_todoId);
         return(Json(result));
     }
     catch (System.Exception exc)
     {
         throw exc;
     }
 }
Exemplo n.º 2
0
 public JsonResult GetToDoById(int _todoId)
 {
     try
     {
         using (var context = new ProjectManagementEntities())
         {
             var list = ToDoDB.GetInstance().GetToDoById(_todoId).ToList();
             return(Json(list));
         }
     }
     catch (System.Exception exc)
     {
         throw exc;
     }
 }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
0
        public JsonResult UpdateToDo(string _todoName, string _todoEndDate, int _todoId, int _projectId, List <int> _todoUsers)
        {
            try
            {
                var _personId = JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("ActivePerson")).Id;
                _todoUsers.Add(_personId);
                _todoUsers = _todoUsers.Distinct().ToList();
                var todolist = new ToDo()
                {
                    Detail    = _todoName,
                    EndDate   = DateTime.ParseExact(_todoEndDate, "dd/MM/yyyy", null),
                    Id        = _todoId,
                    Status    = 1,
                    ProjectId = _projectId
                };
                var result = ToDoDB.GetInstance().UpdateToDo(todolist, _todoUsers);

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