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,Miniage,Maxage")] Age age) { if (id != age.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(age); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AgeExists(age.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(age)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Blogdesc1,Blogdesc2,Title,Date,Status,BlogcategoryId,UserId")] Blog blog) { if (id != blog.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(blog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BlogExists(blog.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.Users, "Id", "Fullname", blog.UserId); ViewData["BlogcategoryId"] = new SelectList(_context.BlogCategories, "Id", "Name", blog.BlogcategoryId); return(View(blog)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Iamgename,Price,Description,Size,Openhourse,Closehours,Startime,TeacherId,AgeeId,CategoryId")] Classroomm classroomm, IFormFile Iamgename, string fileadi) { if (id != classroomm.Id) { return(NotFound()); } if (Iamgename != null) { if (Extension.CheckImg(Iamgename, Extension.MAxfileSize)) { try { classroomm.Iamgename = Extension.SaveImg(Iamgename, path); Extension.Deletimg(path, fileadi); } catch { ModelState.AddModelError("Img", "Img is not correct"); } } else { ModelState.AddModelError("Img", "Img is not correct"); } } else { classroomm.Iamgename = fileadi; } if (ModelState.IsValid) { try { _context.Update(classroomm); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClassroommExists(classroomm.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AgeeId"] = new SelectList(_context.Ages, "Id", "Id", classroomm.AgeeId); ViewData["CategoryId"] = new SelectList(_context.Categoryies, "Id", "Name", classroomm.CategoryId); ViewData["TeacherId"] = new SelectList(_context.Teacherrs, "Id", "Fullname", classroomm.TeacherId); return(View(classroomm)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Fullname,Images,Minidescription,Special,Experience,Phone,Email,Sliderdesc,TitleDesc")] Teacherr teacherr, IFormFile Images, string fileadi) { if (id != teacherr.Id) { return(RedirectToAction("Index", "Teachrrs")); } if (Images != null) { if (Extension.CheckImg(Images, Extension.MAxfileSize)) { try { teacherr.Images = Extension.SaveImg(Images, path); Extension.Deletimg(path, fileadi); } catch { ModelState.AddModelError("Img", "Img is not correct"); } } else { ModelState.AddModelError("Img", "Img is not correct"); } } else { teacherr.Images = fileadi; } if (ModelState.IsValid) { try { _context.Update(teacherr); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeacherrExists(teacherr.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(teacherr)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ImageBlog,BlogId")] GaleryBlog galeryBlog, IFormFile ImageBlog, string fileadi) { if (id != galeryBlog.Id) { return(NotFound()); } if (ImageBlog != null) { if (Extension.CheckImg(ImageBlog, Extension.MAxfileSize)) { try { galeryBlog.ImageBlog = Extension.SaveImg(ImageBlog, path); Extension.Deletimg(path, fileadi); } catch { ModelState.AddModelError("Img", "Img is not correct"); } } else { ModelState.AddModelError("Img", "Img is not correct"); } } else { galeryBlog.ImageBlog = fileadi; } if (ModelState.IsValid) { try { _context.Update(galeryBlog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GaleryBlogExists(galeryBlog.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BlogId"] = new SelectList(_context.Blogs, "Id", "Blogdesc1", galeryBlog.BlogId); return(View(galeryBlog)); }