// GET: Questions/Solution/5 public ActionResult Solution(int?id) { //if (id == null) //{ // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); //} //AnswerViewModel answerViewModel = new AnswerViewModel() { // contactadmin = db.ContactAdmins.Find(id), // answer = db.Answers.Where(a => a.QuestionId == id).FirstOrDefault(), //}; //if (ContactAdmin == null) //{ // return HttpNotFound(); //} //return View(ContactAdmin); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ContactAdmin contactAdmin = db.ContactAdmins.Find(id); if (contactAdmin == null) { return(HttpNotFound()); } return(View(contactAdmin)); }
public ActionResult DeleteConfirmed(int id) { ContactAdmin contactAdmin = db.ContactAdmins.Find(id); db.ContactAdmins.Remove(contactAdmin); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Contact(ContactAdmin contact) { ApplicationDbContext db = new ApplicationDbContext(); db.ContactAdmins.Add(contact); db.SaveChanges(); return(View()); }
public ActionResult Edit([Bind(Include = "Id,Email,Name,Title,Description,Type")] ContactAdmin contactAdmin) { if (ModelState.IsValid) { db.Entry(contactAdmin).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(contactAdmin)); }
public async Task SendEmailAsync(NoticeModel notice) { EmailAdmin emailAdmin = new EmailAdmin(); ContactAdmin contactAdmin = new ContactAdmin(); var contact = await contactAdmin.GetAllContacts(); if (notice.Title != null) { await emailAdmin.SendEmailAsync(contact.First(x => x.Contact.Emails?.Count > 0).Contact, notice.Title, notice.Text); } }
public ActionResult Create([Bind(Include = "Id,Email,Name,Title,Description,Type")] ContactAdmin contactAdmin) { if (ModelState.IsValid) { db.ContactAdmins.Add(contactAdmin); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(contactAdmin)); }
// GET: Questions/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ContactAdmin contactAdmin = db.ContactAdmins.Find(id); if (contactAdmin == null) { return(HttpNotFound()); } return(View(contactAdmin)); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (ContactAdmin != null) { ContactAdmin.Validate(); } if (ContactBilling != null) { ContactBilling.Validate(); } if (ContactRegistrant != null) { ContactRegistrant.Validate(); } if (ContactTech != null) { ContactTech.Validate(); } }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public override void Validate() { base.Validate(); if (ContactAdmin == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ContactAdmin"); } if (ContactBilling == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ContactBilling"); } if (ContactRegistrant == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ContactRegistrant"); } if (ContactTech == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ContactTech"); } if (Consent == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Consent"); } if (ContactAdmin != null) { ContactAdmin.Validate(); } if (ContactBilling != null) { ContactBilling.Validate(); } if (ContactRegistrant != null) { ContactRegistrant.Validate(); } if (ContactTech != null) { ContactTech.Validate(); } }