Beispiel #1
0
        public void TestInitialize()
        {
            target = new CrisisContactLogic();

            dbContacts = new List <CrisisContact>
            {
                new CrisisContact {
                    ID = 1, Contact = new Contact {
                        ID = 1, Phone = "9375555555"
                    }, Name = "Test 1"
                },

                new CrisisContact {
                    ID = 2, Contact = new Contact {
                        ID = 2, Phone = "9375555556"
                    }, Name = "Test 2"
                },
            };

            sampleDisplay = new CrisisContactDisplay
            {
                ContactId   = 1,
                ID          = 1,
                Name        = "Test 1",
                PhoneNumber = "(937) 555-1234"
            };
        }
Beispiel #2
0
 public void TestInitialize()
 {
     target        = new CrisisContactAdminController();
     sampleDisplay = new CrisisContactDisplay
     {
         ID          = 1,
         ContactId   = 1,
         Name        = "test name",
         PhoneNumber = "(555) 555-5555"
     };
 }
Beispiel #3
0
 public ActionResult Create(CrisisContactDisplay crisisContact)
 {
     if (logics.CreateCrisisContact(crisisContact) != null)
     {
         this.TempData["Info"] = $"The crisis contact {crisisContact.Name} was created succesfully.";
         return(this.RedirectToAction("Index"));
     }
     else
     {
         this.TempData["Error"] = $"The crisis contact {crisisContact.Name} was not created.";
         return(this.View(crisisContact));
     }
 }
Beispiel #4
0
        public ActionResult Edit(CrisisContactDisplay crisisContact)
        {
            var isSuccessful = logics.UpdateCrisisContact(crisisContact);

            if (isSuccessful)
            {
                this.TempData["Info"] = $"The crisis contact {crisisContact.Name} was updated succesfully.";
                return(this.RedirectToAction("Index"));
            }
            else
            {
                this.TempData["Error"] = $"The crisis contact {crisisContact.Name} was not updated.";
                return(this.View(crisisContact));
            }
        }
 /// <summary>
 /// Updates the given crisis contact in the database
 /// </summary>
 /// <param name="crisisContact">Display version of the conact to be updated</param>
 /// <returns>Boolean representing if the update was successful</returns>
 public bool UpdateCrisisContact(CrisisContactDisplay crisisContact)
 {
     return(repo.UpdateCrisisContact(crisisContact.ToDbCrisisContact()));
 }
 /// <summary>
 /// Creates a crisis contact in the db.
 /// </summary>
 /// <param name="crisisContact">Display version of the contact to be created</param>
 /// <returns>The id of the newly created contact</returns>
 public int?CreateCrisisContact(CrisisContactDisplay crisisContact)
 {
     return(repo.CreateCrisisContact(crisisContact.ToDbCrisisContact()));
 }
Beispiel #7
0
        public ActionResult Create()
        {
            var crisisContact = new CrisisContactDisplay();

            return(this.View(crisisContact));
        }