public ActionResult DetermineAreaCat(string uid) { List <Category> cats = Db1.ListAllCategories(); List <Area> areas = Db1.ListAllArea(); CatAreaViewModel catPost = new CatAreaViewModel(); catPost.Areas = areas; catPost.Categories = cats; return(View(catPost)); //return View(Db1.areas.FirstOrDefault()); }
public ActionResult DetermineAreaCat(string Areas, string Categories, string uid) { if ((Areas.Equals("") || Areas == null) || (Categories == null || Categories.Equals(""))) { ModelState.AddModelError("Categories", "Both of the Areas and Categories can't be empty!"); List <Category> cats = Db1.ListAllCategories(); List <Area> areas = Db1.ListAllArea(); CatAreaViewModel catPost = new CatAreaViewModel(); catPost.Areas = areas; catPost.Categories = cats; return(View(catPost)); } else { return(RedirectToAction("Create", "Posts", new { AreaId = Areas, CatId = Categories })); } }
private List <CatAreaViewModel> GetDataByLanguage(IQueryable <CatAreaModel> data) { CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture; var results = new List <CatAreaViewModel>(); foreach (var item in data) { var area = new CatAreaViewModel { Id = item.Id, Name = currentCulture.IetfLanguageTag == "en-US" ? item.NameEn : item.NameVn, UserCreated = item.UserCreated, DatetimeCreated = item.DatetimeCreated, UserModified = item.UserModified, DatetimeModified = item.DatetimeModified, Active = item.Active, InActiveOn = item.InactiveOn }; results.Add(area); } return(results); }