Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Date,Price,CustomerId,EmployeeId")] Service service)
        {
            if (id != service.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(service);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ServiceExists(service.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Desctiption")] Relationship relationship)
        {
            if (id != relationship.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(relationship);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RelationshipExists(relationship.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(relationship));
        }
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeID,FirsLastMidName,Age,Gender,Addres,Phone,Passport,PositionID")] 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)));
            }
            ViewData["PositionID"] = new SelectList(_context.Positions, "PositionID", "NamePosition", employee.PositionID);
            return(View(employee));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Note")] Nationality nationality)
        {
            if (id != nationality.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(nationality);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NationalityExists(nationality.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(nationality));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FullName,Age,Sex,Address,PhoneNumber,PassportData")] Employee employee)
        {
            if (id != employee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Edit(int id, [Bind("ServiseID,Date,Cost,ClientID,EmployeeID")] Service service)
        {
            if (id != service.ServiseID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(service);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ServiceExists(service.ServiseID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FullName,Sex,BirthdayDate,Age,Height,Weight,ChildrenCount,MaritalStatus,BadHadits,Hobby,Description,ZodiacSignId,RelationshipId,NationalityId,Address,PhoneNumber,PassportData")] Customer customer)
        {
            if (id != customer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> Edit(int id, [Bind("ClientID,FirsLastMidName,Age,Gender,DateofBirth," +
                                                             "Height,Weight,Children,MaritalStatus,BadHabits,Hobby,Description," +
                                                             "ZodiacSignID,RelationID,NationalID,Addres,Phone,Passport")] Client client)
        {
            if (id != client.ClientID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(client);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientExists(client.ClientID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> Edit(int id, [Bind("id,Name,Description")] ZodiacSign zodiacSign)
        {
            if (id != zodiacSign.Id)
            {
                return(NotFound());
            }

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