public ActionResult Create([Bind(Include = "Id,Title,Company,Employee,CreationDate")] inquiry inquiry, HttpPostedFileBase files) { if (ModelState.IsValid) { if (files != null && files.ContentLength > 0) { // extract only the filename var fileName = Path.GetFileName(files.FileName); // store the file inside ~/App_Data/uploads folder var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName); files.SaveAs(path); inquiry.Images.Add(new Image { Url = path, fileName = fileName }); } inquiry.Employee = HttpContext.User.Identity.GetUserId(); inquiry.CreationDate = DateTime.Now.Date; inquiry.Approved = false; db.inquiries.Add(inquiry); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee = new SelectList(db.AspNetUsers, "Id", "Email", inquiry.Employee); return(View(inquiry)); }
public async Task <IActionResult> Edit(int id, [Bind("inquiry_id,user_id,property_id,user_massege,dateTime_inquiry")] inquiry inquiry) { if (id != inquiry.inquiry_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inquiry); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!inquiryExists(inquiry.inquiry_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(inquiry)); }
public ActionResult DeleteConfirmed(int id) { inquiry inquiry = db.inquiries.Find(id); db.inquiries.Remove(inquiry); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Title,Company,Employee,CreationDate,Approved")] inquiry inquiry) { if (ModelState.IsValid) { db.Entry(inquiry).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee = new SelectList(db.AspNetUsers, "Id", "Email", inquiry.Employee); return(View(inquiry)); }
public async Task <IActionResult> Create([Bind("inquiry_id,user_id,property_id,user_massege,dateTime_inquiry")] inquiry inquiry) { if (ModelState.IsValid) { _context.Add(inquiry); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(inquiry)); }
internal void openForm(Panel Dest, inquiry myInq) //inquary overload { splRight.Panel2.Controls.Clear(); splRight.Panel1.Controls.Clear(); Dest.Controls.Clear(); myInq.TopLevel = false; myInq.ShowInTaskbar = false; myInq.ControlBox = false; myInq.Text = ""; myInq.FormBorderStyle = FormBorderStyle.None; Dest.Controls.Add(myInq); myInq.Show(); }
// GET: inquiries/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } inquiry inquiry = db.inquiries.Find(id); if (inquiry == null) { return(HttpNotFound()); } return(View(inquiry)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } inquiry = await _context.inquiry.FirstOrDefaultAsync(m => m.inquiry_id == id); if (inquiry == null) { return(NotFound()); } return(Page()); }
// GET: inquiries/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } inquiry inquiry = db.inquiries.Find(id); if (inquiry == null) { return(HttpNotFound()); } ViewBag.Employee = new SelectList(db.AspNetUsers, "Id", "Email", inquiry.Employee); return(View(inquiry)); }
// GET: inquiries/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } inquiry inquiry = db.inquiries.Find(id); ViewBag.creater = db.AspNetUsers.Where(u => u.Id == inquiry.Employee); if (inquiry == null) { return(HttpNotFound()); } return(View(inquiry)); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } inquiry = await _context.inquiry.FindAsync(id); if (inquiry != null) { _context.inquiry.Remove(inquiry); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public bool InsertInquiry(inquiry obj) { try { dbcontext.inquiries.InsertOnSubmit(obj); dbcontext.SubmitChanges(); return true; } catch (Exception) { return false; } }
private void customerStatisticsToolStripMenuItem_Click(object sender, EventArgs e) { inquiry myInq = new inquiry(this); openForm(splMain1.Panel1, myInq); }
partial void Updateinquiry(inquiry instance);
partial void Deleteinquiry(inquiry instance);
public bool UpdateInquiry(inquiry obj) { try { inquiry objinquiry = dbcontext.inquiries.Where(t => t.inquiryid == obj.inquiryid).FirstOrDefault(); objinquiry.contactname = obj.contactname; objinquiry.email = obj.email; objinquiry.eventid = obj.eventid; objinquiry.inquirycontent = obj.inquirycontent; objinquiry.inquirydate = obj.inquirydate; objinquiry.mobileno = obj.mobileno; return true; } catch (Exception) { return false; } }
public bool DeleteInquiry(inquiry obj) { try { inquiry objinquiry = dbcontext.inquiries.Where(t => t.inquiryid == obj.inquiryid).FirstOrDefault(); dbcontext.inquiries.DeleteOnSubmit(objinquiry); dbcontext.SubmitChanges(); return true; } catch (Exception) { return false; } }
partial void Insertinquiry(inquiry instance);