public ActionResult Create(LocationAssignment locationassignment) { if (ModelState.IsValid) { unitOfWork.LocationAssignments.Add(locationassignment); unitOfWork.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ClubId = new SelectList(unitOfWork.Clubs.ToList(), "Id", "Id", locationassignment.ClubId); ViewBag.ApplicantUserName = new SelectList(unitOfWork.Users.ToList(), "UserName", "Name", locationassignment.ApplicantUserName); return View(locationassignment); }
public void VerifyLocationApplication(LocationApplication application, bool is_passed, bool save) { if (is_passed) { application.Status = Application.PASSED; LocationAssignment assignment = new LocationAssignment { ApplicantUserName = application.ApplicantUserName, ClubId = application.ClubId ?? 0, Date = application.ApplicatedDate, Locations = application.Locations, Times = application.Times }; application.Assignment = assignment; } else { application.Status = Application.FAILED; } if (save) db.SaveChanges(); }