public IActionResult Create(BlogTagRelate BlogTagRelate) { if (ModelState.IsValid) { _BlogTagRelateRepository.CreateBlogTagRelate(BlogTagRelate); return(RedirectToAction("index")); } return(View(BlogTagRelate)); }
public IActionResult Delete(int id) { BlogTagRelate abs = _BlogTagRelateRepository.GetBlogTagRelateById(id); if (abs == null) { return(NotFound()); } _BlogTagRelateRepository.DeleteBlogTagRelate(abs); return(RedirectToAction("index")); }
public IActionResult Edit(int id) { ViewBag.Blogs = _blogRepository.GetAllBlogs(); ViewBag.BlogTags = _blogTagRepository.GetAllBlogTags(); BlogTagRelate abs = _BlogTagRelateRepository.GetBlogTagRelateById(id); if (abs == null) { return(NotFound()); } return(View(abs)); }
public IActionResult Edit(BlogTagRelate abs) { if (ModelState.IsValid) { BlogTagRelate BlogTagRelateToUpdate = _BlogTagRelateRepository.GetBlogTagRelateById(abs.Id); if (BlogTagRelateToUpdate == null) { return(NotFound()); } _BlogTagRelateRepository.UpdateBlogTagRelate(BlogTagRelateToUpdate, abs); return(RedirectToAction("index")); } return(View(abs)); }
public void UpdateBlogTagRelate(BlogTagRelate BlogTagRelateToUpdate, BlogTagRelate model) { BlogTagRelateToUpdate.BlogId = model.BlogId; BlogTagRelateToUpdate.BlogTagId = model.BlogTagId; _context.SaveChanges(); }
public void DeleteBlogTagRelate(BlogTagRelate BlogTagRelate) { _context.BlogTagRelates.Remove(BlogTagRelate); _context.SaveChanges(); }
public void CreateBlogTagRelate(BlogTagRelate model) { _context.BlogTagRelates.Add(model); _context.SaveChanges(); }