public IActionResult AddCategory([Bind] ChennelCategory model) { if (ModelState.IsValid) { _context.ChennelCategories.Add(model); _context.SaveChanges(); return(View("Index")); } return(View("Index")); }
public IActionResult Update(int id, ChennelCategory model) { var chennel = _context.ChennelCategories.Find(id); if (chennel == null) { return(NotFound()); } chennel.CategoryType = model.CategoryType; chennel.LogoLink = model.LogoLink; _context.ChennelCategories.Update(chennel); _context.SaveChanges(); return(NoContent()); }
public ActionResult <ChennelCategory> CreateChennelCategory(ChennelCategory model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } string categoryType = model.CategoryType; var searchdata = _context.ChennelCategories.FirstOrDefault(x => x.CategoryType == categoryType); if (searchdata == null) { _context.ChennelCategories.Add(model); _context.SaveChanges(); return(model); } else { return(NotFound()); } }