Пример #1
0
        public ActionResult Create(TaskPMVM taskVM)
        {
            string currentUserId = User.Identity.GetUserId();
            //  ApplicationUser currentUser = db.Users.FirstOrDefault(x => x.Id == currentUserId);



            TaskPM t1 = new TaskPM()
            {
                Name = taskVM.Name,

                DeadLine  = taskVM.DeadLine,
                EndDate   = taskVM.EndDate,
                StartDate = taskVM.StartDate,
                Status    = " todo",
                ProjectId = taskVM.ProjectId,
                UserId    = taskVM.User_Id,
                leader    = currentUserId
            };

            MyTaskService.Add(t1);
            MyTaskService.Commit();

            return(RedirectToAction("Index"));
        }
Пример #2
0
        // GET: TaskPM/Edit/5
        public ActionResult Edit(int id)
        {
            var      p   = MyTaskService.GetById(id);
            TaskPMVM pvm = new TaskPMVM();

            p.Name      = pvm.Name;
            p.StartDate = pvm.StartDate;
            //  p.EndDate = pvm.EndDate;

            p.DeadLine = pvm.DeadLine;

            return(View(pvm));
        }
Пример #3
0
        public ActionResult Delete(int id, TaskPMVM pvm)
        {
            TaskPM p = MyTaskService.GetById(id);

            p.Name      = pvm.Name;
            p.StartDate = pvm.StartDate;
            p.EndDate   = pvm.EndDate;
            p.DeadLine  = pvm.DeadLine;

            MyTaskService.Delete(p);
            MyTaskService.Commit();

            return(RedirectToAction("Index"));
        }
Пример #4
0
        // GET: TaskPM/Delete/5
        public ActionResult Delete(int id)
        {
            var      p   = MyTaskService.GetById(id);
            TaskPMVM pvm = new TaskPMVM();

            pvm.TaskId    = p.TaskId;
            pvm.Name      = p.Name;
            pvm.StartDate = p.StartDate;
            pvm.EndDate   = p.EndDate;
            pvm.DeadLine  = p.DeadLine;
            pvm.Status    = p.Status;


            return(View(pvm));
        }
Пример #5
0
        // GET: TaskPM/Details/5
        public ActionResult Details(int id)
        {
            // string userID = Membership.GetUser().ProviderUserKey.ToString();

            //var s = sps.listskills(id);
            var      p   = MyTaskService.GetById(id);
            TaskPMVM pvm = new TaskPMVM();

            pvm.TaskId      = p.TaskId;
            pvm.Name        = p.Name;
            pvm.StartDate   = p.StartDate;
            pvm.DeadLine    = p.DeadLine;
            pvm.Status      = p.Status;
            pvm.ProjectName = MyProjectService.GetById(p.ProjectId).Name;
            pvm.ProjectDesc = MyProjectService.GetById(p.ProjectId).Description;


            //pvm.ProjectSkills = p.ProjectSkills;
            //  pvm.ListResource = p.ListResource;


            return(View(pvm));
        }
Пример #6
0
        // GET: TaskPM
        public ActionResult Index(string searchString)
        {
            //  public Task<ActionResult> Index(string searchString)

            // var user = UserManager.FindByIdAsync(System.Web.HttpContext.Current.User.Identity.GetUserId());
            // user.Id

            string currentUserId = User.Identity.GetUserId();



            List <TaskPMVM> lists = new List <TaskPMVM>();

            foreach (var p in MyTaskService.SearchTasks(searchString))
            {
                if (currentUserId == p.leader)
                {
                    TaskPMVM pvm = new TaskPMVM();
                    pvm.TaskId    = p.TaskId;
                    pvm.Name      = p.Name;
                    pvm.StartDate = p.StartDate;
                    pvm.EndDate   = p.EndDate;
                    pvm.Status    = p.Status;
                    pvm.DeadLine  = p.DeadLine;
                    pvm.ProjectId = p.ProjectId;

                    pvm.ProjectName = MyProjectService.GetById(p.ProjectId).Name;

                    pvm.User_Id  = p.UserId;
                    pvm.UserName = MyUserService.GetById(p.UserId).UserName;

                    lists.Add(pvm);
                }
            }
            return(View(lists));
        }