예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,FullName,Age,Sex,Address,PhoneNumber,PassportData")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Desctiption")] Relationship relationship)
        {
            if (ModelState.IsValid)
            {
                _context.Add(relationship);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(relationship));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Note")] Nationality nationality)
        {
            if (ModelState.IsValid)
            {
                _context.Add(nationality);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(nationality));
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("id,Name,Description")] ZodiacSign zodiacSign)
        {
            if (ModelState.IsValid)
            {
                _context.Add(zodiacSign);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(zodiacSign));
        }
        public async Task <IActionResult> Create([Bind("EmployeeID,FirsLastMidName,Age,Gender,Addres,Phone,Passport,PositionID")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PositionID"] = new SelectList(_context.Positions, "PositionID", "NamePosition", employee.PositionID);
            return(View(employee));
        }
예제 #6
0
        public async Task <IActionResult> Create([Bind("Id,Date,Price,CustomerId,EmployeeId")] Service service)
        {
            if (ModelState.IsValid)
            {
                _context.Add(service);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "Id", "FullName", service.CustomerId);
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "Id", "FullName", service.EmployeeId);
            return(View(service));
        }
        public async Task <IActionResult> Create([Bind("ServiseID,Date,Cost,ClientID,EmployeeID")] Service service)
        {
            if (ModelState.IsValid)
            {
                _context.Add(service);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientID"]   = new SelectList(_context.Clients, "ClientID", "FirsLastMidName", service.ClientID);
            ViewData["EmployeeID"] = new SelectList(_context.Employees, "EmployeeID", "FirsLastMidName", service.EmployeeID);
            return(View(service));
        }
예제 #8
0
        public async Task <IActionResult> Create([Bind("Id,FullName,Sex,BirthdayDate,Age,Height,Weight,ChildrenCount,MaritalStatus,BadHadits,Hobby,Description,ZodiacSignId,RelationshipId,NationalityId,Address,PhoneNumber,PassportData")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["NationalityId"]  = new SelectList(_context.Nationalities, "Id", "Name", customer.NationalityId);
            ViewData["RelationshipId"] = new SelectList(_context.Relationships, "Id", "Name", customer.RelationshipId);
            ViewData["ZodiacSignId"]   = new SelectList(_context.ZodiacSigns, "Id", "Name", customer.ZodiacSignId);
            return(View(customer));
        }
예제 #9
0
        public async Task <IActionResult> Create([Bind("ClientID,FirsLastMidName,Age,Gender,DateofBirth," +
                                                       "Height,Weight,Children,MaritalStatus,BadHabits,Hobby,Description," +
                                                       "ZodiacSignID,RelationID,NationalID,Addres,Phone,Passport")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["NationalID"]   = new SelectList(_context.Nationalities, "NationalID", "Name", client.NationalID);
            ViewData["RelationID"]   = new SelectList(_context.Relations, "RelationID", "Name", client.RelationID);
            ViewData["ZodiacSignID"] = new SelectList(_context.ZodiacSigns, "ZodiacSignID", "Name", client.ZodiacSignID);
            return(View(client));
        }