// POST: api/Contact public HttpResponseMessage Post([FromBody] ContactModel contact) { int contactId = _contactServices.Create(contact); return(contactId > 0 ? Request.CreateResponse(HttpStatusCode.OK, contactId) : Request.CreateResponse(HttpStatusCode.Conflict, "Contact with this email exists.")); }
public ActionResult Contact(FormCollection fc) { string name = fc["name"]; string email = fc["email"]; string msg = fc["msg"]; var contact = new Contact() { Name = name, Email = email, Content = msg, Date = DateTime.Now }; _contact.Create(contact); return(RedirectToAction("Index")); }