public bool CreateSignUp(SignUpCreate model) { var entity = new SignUp() { UserId = _userId, EventId = model.EventId, VolunteerId = model.VolunteerId, CreatedUtc = DateTimeOffset.Now, }; using (var ctx = new ApplicationDbContext()) { ctx.SignUps.Add(entity); return(ctx.SaveChanges() == 1); } } //TODO
public ActionResult Create(SignUpCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreateSignUpService(); if (service.CreateSignUp(model)) { TempData["SaveResult"] = "You Have Signed Up."; return(RedirectToAction("Index")); } ModelState.AddModelError("", "We were unable to complete your request."); return(View(model)); }
// CREATE: SIGNUP public ActionResult Create(int id) { var service = CreateEventService(); var eventDetail = service.GetEventById(id); var volsvc = CreateVolunteerService(); var volunteerDetail = volsvc.GetVolunteerById(volsvc.GetVolunteerIdByUserId()); var model = new SignUpCreate { VolunteerId = volunteerDetail.VolunteerId, LoginId = volunteerDetail.LoginId, FirstName = volunteerDetail.FirstName, LastName = volunteerDetail.LastName, EventId = eventDetail.EventId, Day = eventDetail.Day, ServiceDate = eventDetail.ServiceDate, Location = eventDetail.Location, RequiredVolunteers = eventDetail.RequiredVolunteers, }; return(View(model)); }