public async Task <IActionResult> Edit(int id, [Bind("TaskId,ProjectID,Technology,TaskName,Role,Hours,PricePerHour,sum")] Task task)
        {
            if (id != task.TaskId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(task);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TaskExists(task.TaskId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Details", "Project", new { id = task.Project.ProjectId }));
            }
            ViewData["ProjectID"] = new SelectList(_context.Projects, "ProjectId", "Description", task.ProjectID);
            var project = await _context.Projects.FindAsync(task.ProjectID);

            await _context.SaveChangesAsync();

            return(View(task));
        }
        public async Task <IActionResult> Create([Bind("TaskId,ProjectID,TaskName,Technology,Role,Hours,PricePerHour,sum")] Task task)
        {
            if (ModelState.IsValid)
            {
                task.sum = task.Hours * task.PricePerHour;
                var project = await _context.Projects.FindAsync(task.ProjectID);

                project.PriceForProject += task.sum;
                _context.Add(task);
                _context.Update(project);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", "Project", new { id = project.ProjectId }));
            }
            ViewData["ProjectID"] = new SelectList(_context.Projects, "ProjectId", "Description", task.ProjectID);
            return(View(task));
        }