コード例 #1
0
 public ActionResult Contact(Contact aContact)
 {
     if (contactManager.Add(aContact))
     {
         return(RedirectToAction("HomePage", new { success = "true" }));
     }
     else
     {
         return(RedirectToAction("HomePage", new { success = "false" }));
     }
 }
コード例 #2
0
 internal ContactDTO AddNewContact(ContactDTO Model)
 {
     try
     {
         return(contactManager.Add(Model));
     }
     catch (Exception ex)
     {
         var loger = LogManager.GetLogger("*");
         loger.Log(LogLevel.Error, ex.Message);
         return(null);
     }
 }
コード例 #3
0
        public ActionResult Contact([Bind(Include = "Email,PhoneNo,Message")] ContactViewModel contactViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ContactModel contactm = Mapper.Map <ContactModel>(contactViewModel);

                    _contactManager.Add(contactm);
                    TempData["msg"] = "Message has been send successfully";
                    return(RedirectToAction("Contact"));
                }
                return(View());
            }
            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Home", "Contact")));
            }
        }
コード例 #4
0
        public ActionResult Create(ContactDto contactDto)
        {
            bool result = false;

            if (ModelState.IsValid)
            {
                result = _iContactManager.Add(contactDto);
            }
            else
            {
                result = false;
            }

            if (result)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(contactDto));
            }
        }
コード例 #5
0
 public Contact Post(Contact contact)
 {
     contactManager = new ContactManager(ModelFactory <ContactModel> .GetContext());
     return(contactManager.Add(contact));
 }