public ActionResult Submit(tbl_Ground grd) { int?selectedcategory = grd.CategoryId; int?selectedLocation = grd.LocationId; if (selectedcategory == null && selectedLocation == null) { var grounds = objBs.groundBs.GetAll().Where(x => x.IsApproved == "A"); return(View(grounds)); } else if (selectedcategory != null && selectedLocation == null) { var grounds = objBs.groundBs.GetAll().Where(x => x.IsApproved == "A" && x.CategoryId == selectedcategory); return(View(grounds)); } else if (selectedLocation != null && selectedcategory == null) { var grounds = objBs.groundBs.GetAll().Where(x => x.IsApproved == "A" && x.CategoryId == selectedcategory); return(View(grounds)); } else { var grounds = objBs.groundBs.GetAll().Where(x => x.IsApproved == "A" && x.CategoryId == selectedcategory && x.LocationId == selectedLocation); return(View(grounds)); } }
public void Delete(int Id) { tbl_Ground ground = db.tbl_Ground.Find(Id); db.tbl_Ground.Remove(ground); Save(); }
public ActionResult Submit(tbl_Ground grd) { int?selectedcategory = grd.CategoryId; int?selectedLocation = grd.LocationId; if (selectedcategory == null && selectedLocation == null) { var grounds = objBs.groundBs.GetAll().Where(x => x.IsApproved == "A"); if (grounds.Count() == 0) { TempData["Msg"] = "No Grounds In The Prefered Selection"; } return(View(grounds)); } else if (selectedcategory != null && selectedLocation == null) { var grounds = objBs.groundBs.GetAll().Where(x => x.IsApproved == "A" && x.CategoryId == selectedcategory); if (grounds.Count() == 0) { TempData["Msg"] = "No Grounds In The Prefered Selection"; } return(View(grounds)); } else if (selectedLocation != null && selectedcategory == null) { var grounds = objBs.groundBs.GetAll().Where(x => x.IsApproved == "A" && x.CategoryId == selectedcategory); if (grounds.Count() == 0) { TempData["Msg"] = "No Grounds In The Prefered Selection"; } return(View(grounds)); } else { var grounds = objBs.groundBs.GetAll().Where(x => x.IsApproved == "A" && x.CategoryId == selectedcategory && x.LocationId == selectedLocation); if (grounds.Count() == 0) { TempData["Msg"] = "No Grounds In The Prefered Selection"; } return(View(grounds)); } }
public ActionResult Submit(tbl_Ground ground, HttpPostedFileBase Image) { if (Image != null) { byte[] image = new byte[Image.ContentLength]; Image.InputStream.Read(image, 0, Image.ContentLength); ground.GroundImage = image; } try { ground.IsApproved = "P"; ground.UserId = objBs.userBs.GetAll().Where(X => X.UserEmail == User.Identity.Name).FirstOrDefault().UserId; if (!ModelState.IsValid) { var errors = ModelState .Where(x => x.Value.Errors.Count > 0) .Select(x => new { x.Key, x.Value.Errors }) .ToArray(); } if (ModelState.IsValid) { objBs.groundBs.Insert(ground); TempData["Msg"] = "submited Succesfully"; return(RedirectToAction("Index")); } else { TempData["Msg"] = "submit failed"; return(RedirectToAction("Index")); } } catch (Exception e1) { TempData["Msg"] = "submit failed: " + e1.Message; return(Redirect("Index")); } }
public void Update(tbl_Ground ground) { objdb.Update(ground); }
public void Insert(tbl_Ground ground) { objdb.Insert(ground); }
public void Update(tbl_Ground ground) { db.Entry(ground).State = EntityState.Modified; Save(); }
public void Insert(tbl_Ground ground) { db.tbl_Ground.Add(ground); Save(); }