示例#1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("CompanyId,CompanyName,CompanyLogo,CompanyDescription,CompanyPhone,CompanyEmail,CompanyAddress,CompanyIsDelete")] Company company)
        {
            if (id != company.CompanyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(company);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyExists(company.CompanyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(company));
        }
示例#2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ServiceId,ServiceName,ServiceImage,ServicePrice,ServiceDescription,ServiceCharge,ServiceIsDelete,EmployeeEmployeeId,ServiceTypeServiceTypeId,CompanyCompanyId")] Service service)
        {
            if (id != service.ServiceId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(service);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ServiceExists(service.ServiceId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CompanyCompanyId"]         = new SelectList(_context.Company, "CompanyId", "CompanyId", service.CompanyCompanyId);
            ViewData["EmployeeEmployeeId"]       = new SelectList(_context.Employee, "EmployeeId", "EmployeeId", service.EmployeeEmployeeId);
            ViewData["ServiceTypeServiceTypeId"] = new SelectList(_context.ServiceType, "ServiceTypeId", "ServiceTypeId", service.ServiceTypeServiceTypeId);
            return(View(service));
        }
示例#3
0
        public async Task <IActionResult> Edit(Guid id, [Bind("EmployeeId,DepartmentId,EmployeeFirtName,EmployeeLastName,EmployeeGender,EmployeeDateOfBirth,EmployeeAddress,EmployeePhoneNumber,EmployeeEmail,EmployeeAvatar,EmployeeIsDelete")] Employee employee)
        {
            if (id != employee.EmployeeId)
            {
                return(NotFound());
            }

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