Beispiel #1
0
        public async Task <IActionResult> Create([Bind("CustomerId,Name,VatNumber,Address,ZipCode")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("ProjectId,Title,Description,CreateDate,EndDate,DeliveryDate,CustomerId")] Project project)
        {
            if (ModelState.IsValid)
            {
                _context.Add(project);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "Name", project.CustomerId);
            return(View(project));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("TaskId,Title,Description,BillableTime,CreateDate,EndDate,ProjectId,CostPerHour")] Models.Task task)
        {
            if (ModelState.IsValid)
            {
                task.TaskCost = CalculateTaskCost(task);

                _context.Add(task);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProjectId"] = new SelectList(_context.Projects, "ProjectId", "ProjectId", task.ProjectId);
            return(View(task));
        }