public bool AddContact(GeneralDTO model) { Contact contact = new Contact(); contact.Subject = model.Subject; contact.NameSurname = model.Name; contact.Email = model.Email; contact.Message = model.Message; contact.AddDate = DateTime.Now; contact.LastUpdateDate = DateTime.Now; dao.AddContact(contact); return(true); }
protected void submitbtn_Click(object sender, EventArgs e) { string User_ID = Session["passuser"].ToString(); // string Ordered_by = "sakiftahmid"; string Subject = subjecttxt.Text; // string Ordered_item = Session["passres"].ToString(); // string Ordered_item = "biriani"; // int Quantity = Convert.ToInt32(Session["passquan"].ToString()); // int Quantity = 5; string Text = querytxt.Text; ContactDao.AddContact(new ContactDTO(User_ID, Subject, Text)); Response.Redirect("WebForm2.aspx"); }
public ActionResult Contact(ContactModel contactModel) { try { ContactDAO contactDAO = new ContactDAO(); int res = contactDAO.AddContact(contactModel.FirstName, contactModel.LastName, Convert.ToInt32(contactModel.Phone), contactModel.Email, contactModel.Address); if (res > 0) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Gửi thành công"); return(View()); } } catch (System.Exception ex) { var x = ex.Message; return(View()); } }