Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Text")] OurVision ourVision)
        {
            if (id != ourVision.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ourVision);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OurVisionExists(ourVision.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ourVision));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] BlogCategory blogCategory)
        {
            if (id != blogCategory.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(blogCategory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BlogCategoryExists(blogCategory.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(blogCategory));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,CarModelId,Transmission,Fuel,Passsenger,Luggage,Door,Title,DailyPrice,Discount,Description,Status,Photo,CartPhoto,DetailPhoto")] Car car)
        {
            if (id != car.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(car);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CarExists(car.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CarModelId"] = new SelectList(_context.CarModels, "Id", "Name", car.CarModelId);
            return(View(car));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CarBrandId")] CarModel carModel)
        {
            if (id != carModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(carModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CarModelExists(carModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CarBrandId"] = new SelectList(_context.CarBrands, "Id", "Name", carModel.CarBrandId);
            return(View(carModel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Photo,Name,Position,FacebookLink,TwitterLink,InstagramLink,LinkedInLink")] Team team)
        {
            if (id != team.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(team);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeamExists(team.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(team));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Photo,Name")] Partner partner)
        {
            if (id != partner.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(partner);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PartnerExists(partner.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(partner));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Price,OrderItemId")] CarExtraService carExtraService)
        {
            if (id != carExtraService.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(carExtraService);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CarExtraServiceExists(carExtraService.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrderItemId"] = new SelectList(_context.OrderItems, "Id", "Id", carExtraService.OrderItemId);
            return(View(carExtraService));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Icon,Name")] CarType carType)
        {
            if (id != carType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(carType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CarTypeExists(carType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(carType));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Question,Answer")] Faq faq)
        {
            if (id != faq.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(faq);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FaqExists(faq.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(faq));
        }
Пример #10
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Icon,Title,Text")] WhatWeOffer whatWeOffer)
        {
            if (id != whatWeOffer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(whatWeOffer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WhatWeOfferExists(whatWeOffer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(whatWeOffer));
        }
Пример #11
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FacebookLink,TwitterLink,InstagramLink,GoogleLink,LinkedInLink,Phone,SupPhone,Email,SaleEmail,MainAdress,Adress,Logo,FooterLogo,FooterText,Payment")] Setting setting)
        {
            if (id != setting.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(setting);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SettingExists(setting.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(setting));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,BlogId")] Tag tag)
        {
            if (id != tag.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tag);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TagExists(tag.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BlogId"] = new SelectList(_context.Blogs, "Id", "InfoText", tag.BlogId);
            return(View(tag));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Text,Name,Position,Company,Photo")] Testimonial testimonial)
        {
            if (id != testimonial.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(testimonial);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TestimonialExists(testimonial.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(testimonial));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Photo,Title,Text")] SliderItem sliderItem)
        {
            if (id != sliderItem.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sliderItem);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SliderItemExists(sliderItem.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sliderItem));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,GalleryId,Photo,PhotoSm")] GalleryItem galleryItem)
        {
            if (id != galleryItem.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(galleryItem);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GalleryItemExists(galleryItem.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                if (galleryItem.PhotoSmFile != null)
                {
                    try
                    {
                        FileManager fileManager = new FileManager(_webHostEnvironment);
                        galleryItem.PhotoSm = fileManager.Upload(galleryItem.PhotoSmFile);
                    }
                    catch (Exception e)
                    {
                        ModelState.AddModelError("PhotoSmFile", e.Message);
                    }
                }
                return(RedirectToAction(nameof(Index), "Galleries"));
            }
            return(View(galleryItem));
        }