Пример #1
0
        public async Task <IActionResult> Create([Bind("CompanyId,CompanyName,CompanyLogo,CompanyDescription,CompanyPhone,CompanyEmail,CompanyAddress,CompanyIsDelete")] Company company)
        {
            if (ModelState.IsValid)
            {
                company.CompanyId = Guid.NewGuid();
                _context.Add(company);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(company));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("EmployeeId,DepartmentId,EmployeeFirtName,EmployeeLastName,EmployeeGender,EmployeeDateOfBirth,EmployeeAddress,EmployeePhoneNumber,EmployeeEmail,EmployeeAvatar,EmployeeIsDelete")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                employee.EmployeeId = Guid.NewGuid();
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("ServiceId,ServiceName,ServiceImage,ServicePrice,ServiceDescription,ServiceCharge,ServiceIsDelete,EmployeeEmployeeId,ServiceTypeServiceTypeId,CompanyCompanyId")] Service service)
        {
            if (ModelState.IsValid)
            {
                service.ServiceId = Guid.NewGuid();
                _context.Add(service);
                await _context.SaveChangesAsync();

                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));
        }