예제 #1
0
 public WrapResponseResult <ResponseWrapper <BaseContactResponse> > Add(AddContactRequest request)
 {
     return(new WrapResponseResult <ResponseWrapper <BaseContactResponse> >(() =>
     {
         if (request != null && ModelState.IsValid)
         {
             ResponseWrapper <BaseContactResponse> response = null;
             response = _contactService.Add(request);
             return response;
         }
         else
         {
             ResponseWrapper <BaseContactResponse> response = null;
             response = ResponseWrapper <BaseContactResponse> .GetBadRequestErrorResponse();
             return response;
         }
     }, this.Request));
 }
예제 #2
0
 public ActionResult LienHe(Contact entity, string txtCaptcha)
 {
     if (ModelState.IsValid)
     {
         string text = Session["CAPTCHA"].ToString();
         if (txtCaptcha.ToLower() == text.ToLower())
         {
             var model = new Contact();
             model.contactFullName = entity.contactFullName;
             model.contactTitle    = entity.contactTitle;
             model.contactEmail    = entity.contactEmail;
             model.contactBody     = entity.contactBody;
             model.createTime      = DateTime.Now;
             model.isTrash         = false;
             _contactServices.Add(model);
             _contactServices.Save();
             return(Redirect("/"));
         }
         return(View(entity));
     }
     return(View(entity));
 }
예제 #3
0
 public async Task <Contact> AddContact(Contact contact)
 {
     return(await _contactService.Add(contact));
 }