Exemplo n.º 1
0
        // 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));
        }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            ContactAdmin contactAdmin = db.ContactAdmins.Find(id);

            db.ContactAdmins.Remove(contactAdmin);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public ActionResult Contact(ContactAdmin contact)
        {
            ApplicationDbContext db = new ApplicationDbContext();

            db.ContactAdmins.Add(contact);
            db.SaveChanges();

            return(View());
        }
Exemplo n.º 4
0
 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);
            }
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
        // 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();
     }
 }
Exemplo n.º 9
0
 /// <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();
     }
 }