public ActionResult CreateRider([Bind(Include = "Id,UserId,Name,Address,Mobile,Remarks,RiderStatusId,MasterCityId,Mobile2")] RiderDetail riderDetail, int?userApplicationId) { if (ModelState.IsValid) { if (CheckRiderRegFields(riderDetail, userApplicationId)) { if (store.AdminMgr.AddRiderDetails(riderDetail)) { //update Application status //get user application var userAppDetails = store.AdminMgr.GetUserApplication((int)userApplicationId); userAppDetails.UserApplicationStatusId = 2; //Accepted if (store.AdminMgr.EditUserApplication(userAppDetails)) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Unable to Update Application status to accepted"); } } else { ModelState.AddModelError("", "Unable to Add new Store Detail. "); } } } ViewBag.MasterCityId = new SelectList(store.RefDbLayer.GetMasterCities(), "Id", "Name", riderDetail.MasterCityId); ViewBag.RiderStatusId = new SelectList(store.RefDbLayer.GetRiderStatus(), "Id", "Name", riderDetail.RiderStatusId); ViewBag.UserApplicationId = userApplicationId; return(View(riderDetail)); }
public void RegisterRider(RiderRegistration newRider) { try { RiderDetail rider = new RiderDetail() { Id = 0, UserId = newRider.UserId, Name = newRider.Name, Address = newRider.Address, Mobile = newRider.Mobile, Mobile2 = newRider.Mobile2, MasterCityId = newRider.MasterCityId, Remarks = newRider.Remarks, RiderStatusId = 1, }; db.RiderDetails.Add(rider); db.SaveChanges(); } catch (Exception ex) { throw ex; } }
public ActionResult DeleteConfirmed(int id) { RiderDetail riderDetail = db.RiderDetails.Find(id); db.RiderDetails.Remove(riderDetail); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { RiderDetail riderDetail = store.AdminMgr.GetRiderDetails((int)id); if (store.AdminMgr.RemoveRiderDetails(riderDetail)) { return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public bool RemoveRiderDetails(RiderDetail riderDetail) { try { return(adminDb.RemoveRiderDetails(riderDetail)); } catch { return(false); } }
public ActionResult Create([Bind(Include = "Id,UserId,Name,Address,Mobile,Remarks,RiderStatusId,MasterCityId,Mobile2")] RiderDetail riderDetail) { if (ModelState.IsValid) { return(RedirectToAction("Index")); } ViewBag.MasterCityId = new SelectList(store.RefDbLayer.GetMasterAreas(), "Id", "Name", riderDetail.MasterCityId); ViewBag.RiderStatusId = new SelectList(store.RefDbLayer.GetRiderStatus(), "Id", "Name", riderDetail.RiderStatusId); return(View(riderDetail)); }
public bool EditRiderDetails(RiderDetail riderDetail) { try { return(adminDb.EditRiderDetails(riderDetail)); } catch { return(false); } }
public ActionResult Edit([Bind(Include = "Id,UserId,Name,Address,Mobile,Remarks,RiderStatusId,MasterCityId,Mobile2")] RiderDetail riderDetail) { if (ModelState.IsValid) { db.Entry(riderDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MasterCityId = new SelectList(db.MasterCities, "Id", "Name", riderDetail.MasterCityId); ViewBag.RiderStatusId = new SelectList(db.RiderStatus, "Id", "Name", riderDetail.RiderStatusId); return(View(riderDetail)); }
public bool RemoveRiderDetails(RiderDetail riderDetail) { try { db.RiderDetails.Remove(riderDetail); db.SaveChanges(); return(true); } catch { return(false); } }
public bool EditRiderDetails(RiderDetail riderDetail) { try { db.Entry(riderDetail).State = EntityState.Modified; db.SaveChanges(); return(true); } catch { return(false); } }
public bool AddRiderDetails(RiderDetail riderDetail) { try { db.RiderDetails.Add(riderDetail); db.SaveChanges(); return(true); } catch { return(false); } }
// GET: Admin/RiderDetails/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RiderDetail riderDetail = store.AdminMgr.GetRiderDetails((int)id); if (riderDetail == null) { return(HttpNotFound()); } return(View(riderDetail)); }
// GET: Rider/RiderDetails/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RiderDetail riderDetail = db.RiderDetails.Find(id); if (riderDetail == null) { return(HttpNotFound()); } return(View(riderDetail)); }
// GET: Rider/RiderDetails/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RiderDetail riderDetail = db.RiderDetails.Find(id); if (riderDetail == null) { return(HttpNotFound()); } ViewBag.MasterCityId = new SelectList(db.MasterCities, "Id", "Name", riderDetail.MasterCityId); ViewBag.RiderStatusId = new SelectList(db.RiderStatus, "Id", "Name", riderDetail.RiderStatusId); return(View(riderDetail)); }
// GET: Admin/RiderDetails/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RiderDetail riderDetail = store.AdminMgr.GetRiderDetails((int)id); if (riderDetail == null) { return(HttpNotFound()); } ViewBag.MasterCityId = new SelectList(store.RefDbLayer.GetMasterCities(), "Id", "Name", riderDetail.MasterCityId); ViewBag.RiderStatusId = new SelectList(store.RefDbLayer.GetRiderStatus(), "Id", "Name", riderDetail.RiderStatusId); return(View(riderDetail)); }
// GET: Admin/RiderDetails/Create public ActionResult CreateRider(int id) { var userAppDetails = store.AdminMgr.GetUserApplication(id); var userDetails = userAppDetails.UserDetail; RiderDetail newRider = new RiderDetail() { UserId = userDetails.UserId, Name = userDetails.Name, Address = userDetails.Address, Mobile = userDetails.Mobile }; ViewBag.MasterCityId = new SelectList(store.RefDbLayer.GetMasterCities(), "Id", "Name", userDetails.MasterCityId); ViewBag.RiderStatusId = new SelectList(store.RefDbLayer.GetRiderStatus(), "Id", "Name", 1); ViewBag.UserApplicationId = id; return(View(newRider)); }
public bool CheckRiderRegFields(RiderDetail riderDetail, int?appId) { bool isValid = true; if (riderDetail.Name.IsNullOrWhiteSpace()) { ModelState.AddModelError("Name", "Name field is empty."); isValid = false; } if (riderDetail.Address.IsNullOrWhiteSpace()) { ModelState.AddModelError("Address", "Address field is empty."); isValid = false; } if (riderDetail.UserId.IsNullOrWhiteSpace()) { ModelState.AddModelError("UserId", "UserId field is empty."); isValid = false; } if (riderDetail.Mobile.IsNullOrWhiteSpace()) { ModelState.AddModelError("Mobile", "Mobile field is empty."); isValid = false; } if (appId == null) { ModelState.AddModelError("", "Application Id field is empty."); isValid = false; } return(isValid); }
public bool AddRiderDetails(RiderDetail riderDetail) { return(rdb.AddRiderDetails(riderDetail)); }
public bool RemoveRiderDetails(RiderDetail riderDetail) { return(rdb.RemoveRiderDetails(riderDetail)); }
public bool EditRiderDetails(RiderDetail riderDetail) { return(rdb.EditRiderDetails(riderDetail)); }