Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("paragraphID,title,section1,section2,section3")] homeParagraph homeParagraph)
        {
            if (id != homeParagraph.paragraphID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(homeParagraph);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!homeParagraphExists(homeParagraph.paragraphID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(homeParagraph));
        }
        public async Task <IActionResult> Edit(int id, [Bind("misyonID,title,content")] misyonumuz misyonumuz)
        {
            if (id != misyonumuz.misyonID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(misyonumuz);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!misyonumuzExists(misyonumuz.misyonID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(misyonumuz));
        }
        public async Task <IActionResult> Edit(int id, [Bind("vizyonListID,content")] vizyonList vizyonList)
        {
            if (id != vizyonList.vizyonListID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vizyonList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!vizyonListExists(vizyonList.vizyonListID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vizyonList));
        }
Пример #4
0
        public async Task <IActionResult> Edit(int id, [Bind("mapID,stringURL")] maps maps)
        {
            if (id != maps.mapID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(maps);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!mapsExists(maps.mapID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(maps));
        }
        public async Task <IActionResult> Edit(int id, [Bind("adresID,mahalle,sokak,isYeri,No,ilce,sehir")] adress adress)
        {
            if (id != adress.adresID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(adress);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!adressExists(adress.adresID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(adress));
        }
Пример #6
0
        public async Task <IActionResult> Edit(int id, [Bind("phoneID,phoneNumber")] phone phone)
        {
            if (id != phone.phoneID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(phone);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!phoneExists(phone.phoneID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(phone));
        }
Пример #7
0
        public async Task <IActionResult> Edit(int id, [Bind("haritaID,Adres,x,y,aciklama")] Haritalar haritalar)
        {
            if (id != haritalar.haritaID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(haritalar);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HaritalarExists(haritalar.haritaID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(haritalar));
        }
        public async Task <IActionResult> Edit(int id, [Bind("cardID,baslik,aciklama,icerik,imgFile")] homeCards proje, string fname)
        {
            if (id != proje.cardID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    string wwwRootPath = _hostEnvironment.WebRootPath;

                    string fileName  = Path.GetFileNameWithoutExtension(proje.imgFile.FileName);
                    string extension = Path.GetExtension(proje.imgFile.FileName);
                    proje.imgYol = fileName = fileName + DateTime.Now.ToString("yymmssffff") + extension;
                    //proje.imgYol = fileName = proje.imgFile.FileName;
                    string path = Path.Combine(wwwRootPath + "/cardImg/", fileName);
                    proje.cardID = id;
                    using (var fileStream = new FileStream(path, FileMode.Create))
                    {
                        await proje.imgFile.CopyToAsync(fileStream);
                    }

                    var imgid = await _context.homeCards.FindAsync(id);

                    _context.homeCards.Remove(imgid);
                    fname = Path.Combine(wwwRootPath + "/cardImg/", fileName);
                    FileInfo fi = new FileInfo(fname);
                    if (fi.Exists)
                    {
                        System.IO.File.Delete(fname);
                        fi.Delete();
                    }

                    createImage(proje);

                    _context.Update(proje);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!homeCardsExists(proje.cardID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(proje));
        }