public ActionResult RSVP() { var model = new RSVPModel(); if (AreaKind > AreaKind.General) { model.SelectedProduct = Area; } return(GetCustomerDto("09a0b9fe-bc41-4fa4-a365-a7cb00e4b31c", model)); }
public IActionResult leaveActivity(int id) { if (HttpContext.Session.GetString("UserName") == null) { return(RedirectToAction("LogIn", "User")); } int? UserId = HttpContext.Session.GetInt32("User_Id"); RSVPModel rsvp = dbContext.RSVPs .Where(r => r.Activity_Id == id && r.User_Id == UserId) .FirstOrDefault(); dbContext.RSVPs.Remove(rsvp); dbContext.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult RSVP(int id) { if (HttpContext.Session.GetString("UserName") == null) { return(RedirectToAction("LogIn", "User")); } RSVPModel NewRSVP = new RSVPModel() { Activity_Id = id, User_Id = (int)HttpContext.Session.GetInt32("User_Id") }; dbContext.RSVPs.Add(NewRSVP); dbContext.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult RSVP(RSVPModel model) { var notes = new StringBuilder(1000); notes.AppendLine(model.Notes); var customer = SaveCustomerDto(model, "Customer RSVP to Balcony open house event", 500, notes.ToString()); try { var strBody = new StringBuilder(1000); strBody.AppendLine("<html><body>"); strBody.AppendLine("<h2><u>Customer RSVPed to Balcony open house event</u></h2>"); strBody.AppendLine("<table border=0>"); strBody.AppendLine("<tr><td align=right nowrap><b>Name:</b></td><td>" + customer.DefaultContact.FullName + "</td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>E-mail:</b></td><td>" + model.Email1 + "</td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>Company:</b></td><td>" + customer.CompanyName + "</td></tr>"); strBody.AppendLine("<tr><td> </td><td></td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>Address1:</b></td><td>" + model.House + "</td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>Address2:</b></td><td>" + model.Street + "</td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>Town\\City:</b></td><td>" + model.Town + "</td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>Country:</b></td><td>" + customer.PrimaryAddress.Country.Name_En + "</td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>Region:</b></td><td>" + customer.PrimaryAddress.Region.Name_En + "</td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>County:</b></td><td>" + customer.PrimaryAddress.SubRegion.Name_En + "</td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>Postcode:</b></td><td>" + model.PostCode + "</td></tr>"); strBody.AppendLine("<tr><td> </td><td></td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>Phone:</b></td><td>" + model.Phone + "</td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>Mobile:</b></td><td>" + model.Mobile + "</td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>Fax:</b></td><td>" + model.Fax + "</td></tr>"); strBody.AppendLine("<tr><td> </td><td></td></tr>"); strBody.AppendLine("<tr><td align=right><b>Notes:</b></td><td>" + model.Notes + "</td></tr>"); strBody.AppendLine("<tr><td align=right nowrap><b>BV Subscription:</b></td><td>" + (model.Subscription ? "Yes" : "No") + "</td></tr>"); strBody.AppendLine("</table></body></html>"); var mlClient = new MailManager(); mlClient.SendMail(WebGlobal.SystemMail, WebGlobal.BrochuresMail, "Customer RSVPed to Balcony open house event", strBody.ToString()); var body = TemplateService.GetText(DbSession.Get <Template>(new Guid("f02e41b9-c9e9-e011-9d71-58b0358c18e0")).Body, customer); } catch (Exception ex) { WebGlobal.HandleException(ex, System.Web.HttpContext.Current); } return(Redirect("/general/rsvp-success")); }
public IActionResult CreateActivity(ActivityModel Activity) { if (ModelState.IsValid) { DateTime End = Activity.StartDateTime; if (Activity.DurationMeasure == "Minutes") { End = End.AddMinutes(Activity.Duration1); } if (Activity.DurationMeasure == "Hours") { End = End.AddHours(Activity.Duration1); } if (Activity.DurationMeasure == "Days") { End = End.AddDays(Activity.Duration1); } Activity.EndDateTime = End; dbContext.Activities.Add(Activity); dbContext.SaveChanges(); RSVPModel NewRSVP = new RSVPModel() { Activity_Id = Activity.Activity_Id, User_Id = (int)HttpContext.Session.GetInt32("User_Id") }; dbContext.RSVPs.Add(NewRSVP); dbContext.SaveChanges(); return(viewActivity(Activity.Activity_Id)); } else { ViewBag.user_id = HttpContext.Session.GetInt32("User_Id"); ViewBag.user_name = HttpContext.Session.GetString("UserName"); return(View("NewActivity")); } }