예제 #1
0
        // GET: Project/Delete/5
        public async Task <IActionResult> Delete(int?id)
        {
            var project = await db.Projects.FindAsync(id);

            db.Projects.Remove(project);
            await db.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
예제 #2
0
 public async Task <IActionResult> Index(ProjectTask task)
 {
     if (ModelState.IsValid)
     {
         ProjectTask projectTask = new ProjectTask
         {
             TaskName            = task.TaskName,
             PercentageOfProject = task.PercentageOfProject,
             ProjectId           = task.ProjectId
         };
         db.Tasks.Add(projectTask);
         await db.SaveChangesAsync();
     }
     return(RedirectToAction("Info", "CurrentProject", new
     {
         projectId = task
                     .ProjectId
     }));
 }
예제 #3
0
        // GET: Project/Delete/5
        public async Task <IActionResult> DeleteTask(int?id)
        {
            var task = await hAPPAN_MVC_AuthDBContext.Tasks.FindAsync(id);

            var projectid = task.ProjectId;

            hAPPAN_MVC_AuthDBContext.Tasks.Remove(task);
            await hAPPAN_MVC_AuthDBContext.SaveChangesAsync();

            return(RedirectToAction("Info", "CurrentProject", new
            {
                projectId = projectid
            }));
        }
예제 #4
0
        public async Task <IActionResult> Index([Bind("ProjectId,ProjectName,Status")] Project Projects)
        {
            if (ModelState.IsValid)
            {
                if (Projects.ProjectId == 0)
                {
                    hAPPAN_MVC_AuthDBContext.Add(Projects);
                }
                else
                {
                    hAPPAN_MVC_AuthDBContext.Update(Projects);
                }
                await hAPPAN_MVC_AuthDBContext.SaveChangesAsync();

                return(RedirectToAction("Index", "Home"));
            }
            return(View(Projects));
        }