コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Business,Rate")] BusinessValues businessValues)
        {
            if (id != businessValues.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(businessValues);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BusinessValuesExists(businessValues.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(businessValues));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, Jobs jobs)
        {
            if (id != jobs.Id)
            {
                return(NotFound());
            }
            var clientname = _context.Clients.Where(x => x.Id == jobs.ClientId).FirstOrDefault();

            if (ModelState.IsValid)
            {
                try
                {
                    jobs.ClientName = clientname.Client;
                    _context.Update(jobs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JobsExists(jobs.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"] = new SelectList(_context.Clients, "Id", "Client", jobs.ClientId);
            return(View(jobs));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,DateCreated,Status,Description,TimeSpent,TaskId,JobId,ClientId,BusinessValueId,AssigneeId")] JobTasks jobTasks)
        {
            if (id != jobTasks.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobTasks);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JobTasksExists(jobTasks.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BusinessValueId"] = new SelectList(_context.BusinessValues, "Id", "Id", jobTasks.BusinessValueId);
            ViewData["ClientId"]        = new SelectList(_context.Clients, "Id", "Id", jobTasks.ClientId);
            ViewData["JobId"]           = new SelectList(_context.Jobs, "Id", "Id", jobTasks.JobId);
            ViewData["TaskId"]          = new SelectList(_context.Tasks, "Id", "Id", jobTasks.TaskId);
            ViewData["AssigneeId"]      = new SelectList(_context.Users, "Id", "Id", jobTasks.AssigneeId);
            return(View(jobTasks));
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Task,JobId,BusinessValuesId,TasksRate,Status,InvoiceTypeId")] Tasks tasks)
        {
            if (id != tasks.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tasks);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TasksExists(tasks.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BusinessValuesId"] = new SelectList(_context.BusinessValues, "Id", "Business", tasks.BusinessValuesId);
            ViewData["JobId"]            = new SelectList(_context.Jobs, "Id", "Id", tasks.JobId);
            ViewData["InvoiceTypeId"]    = new SelectList(_context.InvoiceType, "Id", "Type");
            return(View(tasks));
        }
コード例 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerName")] Clients clients)
        {
            if (id != clients.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clients);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomersExists(clients.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clients));
        }
コード例 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Status")] JobStatus jobStatus)
        {
            if (id != jobStatus.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobStatus);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JobStatusExists(jobStatus.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobStatus));
        }
コード例 #7
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,Date,TaskId,Status,Description,TimeSpent,JobId,ClientId,BusinessValueId,AssigneeId")] JobTasks jobTasks)
        {
            if (id != jobTasks.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobTasks);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TimesheetExists(jobTasks.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobTasks));
        }
コード例 #8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Type")] InvoiceType invoiceType)
        {
            if (id != invoiceType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(invoiceType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InvoiceTypeExists(invoiceType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(invoiceType));
        }