public IHttpActionResult PutEmployee(int id, Employee employee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != employee.Id) { return(BadRequest()); } db.Entry(employee).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutContact(int id, Contact contact) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != contact.ID) { return(BadRequest()); } db.Entry(contact).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ContactExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Create([Bind(Include = "Theater_Id,T_ID,Theater_Name,Capacity,Location")] Theater_Info theater_Info) { if (ModelState.IsValid) { db.Theater_Info.Add(theater_Info); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(theater_Info)); }
public ActionResult ContactUs(ContactUsModel model) { MailMessage mm = new MailMessage("*****@*****.**", model.EmaiId) { Subject = model.FirstName, Body = "Hello," + "<div>-----" + "<div>Subject: " + model.Subject + "<div>Cmment/Questions: " + model.comment + "<div><div>-----<div>Regards," + "<div>" + model.FirstName, IsBodyHtml = true }; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.UseDefaultCredentials = false; smtp.Credentials = new NetworkCredential("*****@*****.**", "Note@tatva"); smtp.Send(mm); projectEntities1 db = new projectEntities1(); comment c = new comment(); c.FullName = model.FirstName; c.EmailId = model.EmaiId; c.Comment1 = model.comment; c.Subject = model.Subject; db.comments.Add(c); db.SaveChanges(); TempData["Success"] = "Email sent Successfully Done!"; return(RedirectToAction("ContactUs", "Auth")); }
protected void Button1_Click(object sender, EventArgs e) { if (FBId != null) { string email = DisplayEmail.ToString(); using (projectEntities1 context = new projectEntities1()) { var customer_alt = (from c in context.Customer_Info where c.Email == email select c).ToList(); if (customer_alt != null) { Response.Redirect("default.aspx"); } } using (projectEntities1 context = new projectEntities1()) { Customer_Info customer = new Customer_Info(); customer.Customer_Name = displayname.ToString(); customer.Email = DisplayEmail.ToString(); customer.Customer_Password = FBId.ToString(); customer.Phone_No = "phone no"; context.Customer_Info.Add(customer); context.SaveChanges(); Session["Customer_Id"] = displayname.ToString(); } Response.Redirect("~/default.aspx"); } }
public ActionResult ChangePass(ChangePassModel cpm) { if (Session["Id"] != null) { int id = Convert.ToInt32(Session["Id"].ToString()); using (projectEntities1 db = new projectEntities1()) { MembersData usr = db.MembersDatas.Where(u => u.Id == id).FirstOrDefault(); { if (cpm.OldPassword == usr.Password) { usr.CPassword = cpm.CPassword; usr.Password = cpm.CPassword; db.SaveChanges(); TempData["Success"] = "Password Successfully Changed!"; return(RedirectToAction("Login", "Auth")); } else { TempData["Success"] = "OldPassword miss match"; return(RedirectToAction("Registration", "Auth")); } } } } else { return(RedirectToAction("Forgot", "Auth")); } }
public ActionResult Addcountry(AddCountrymodel add) { using (projectEntities1 db = new projectEntities1()) { if (Session["Id"] != null) { int id = Convert.ToInt32(Session["Id"].ToString()); MembersData usr = db.MembersDatas.Where(u => u.Id == id).FirstOrDefault(); { admin a = db.admins.Where(u => u.CreatedBy == id).FirstOrDefault(); { Country c = new Country(); c.Country1 = add.country; c.Description = add.dis; c.Date = DateTime.Now; c.AdminId = a.Id; c.IsActive = true; db.Countries.Add(c); db.SaveChanges(); } } return(View()); } } return(View()); }
public ActionResult Approve(int id) { projectEntities1 db = new projectEntities1(); NoteDetail data = db.NoteDetails.Where(u => u.Id == id).FirstOrDefault(); { data.Status = "Published"; db.SaveChanges(); return(View()); } }
public ActionResult ConfirmEmail(string Email) { using (projectEntities1 db = new projectEntities1()) { MembersData usr = db.MembersDatas.Where(u => u.EmailId == Email).FirstOrDefault(); usr.IsEmailVerified = true; usr.CPassword = "******"; db.SaveChanges(); return(View(usr)); } }
public ActionResult EditNotes(string noteid, AddNotesModel notesModel, HttpPostedFileBase dp, HttpPostedFileBase uploadnote, HttpPostedFileBase notepreview) { if (Session["Id"] != null) { int id = Convert.ToInt32(Session["Id"].ToString()); using (projectEntities1 db = new projectEntities1()) { MembersData usr = db.MembersDatas.Where(u => u.Id == id).FirstOrDefault(); { NoteDetail notes = db.NoteDetails.Where(u => u.NoteTitle == noteid).FirstOrDefault(); { notes.Status = "Inreview"; string fileName = Path.GetFileName(dp.FileName); notesModel.dppath = "~/images/" + fileName; fileName = Path.Combine(Server.MapPath("~/images/"), fileName); dp.SaveAs(fileName); string fileName1 = Path.GetFileName(uploadnote.FileName); notesModel.uploadpath = "~/images/" + fileName1; fileName = Path.Combine(Server.MapPath("~/images/"), fileName1); uploadnote.SaveAs(fileName); string fileName2 = Path.GetFileName(notepreview.FileName); notesModel.notepath = "~/images/" + fileName2; fileName = Path.Combine(Server.MapPath("~/images/"), fileName2); notepreview.SaveAs(fileName); notes.ApprovedDate = DateTime.Now; notes.DisplayPic = notesModel.dppath; notes.Preview = notesModel.notepath; notes.note = notesModel.uploadpath; db.SaveChanges(); return(RedirectToAction("SearchNotes", "NoteDetails")); } } } } else { return(View()); } }
protected void Button1_Click(object sender, EventArgs e) { using (projectEntities1 context = new projectEntities1()) { Customer_Info _insert = new Customer_Info(); _insert.Customer_Name = TextBox1.Text; _insert.Email = TextBox2.Text; _insert.Customer_Password = TextBox3.Text; _insert.Phone_No = Decimal.Parse(TextBox4.Text); context.Customer_Info.Add(_insert); context.SaveChanges(); } Response.Redirect("Log-In.aspx"); }
public ActionResult Forgot(MembersData ml) { using (projectEntities1 db = new projectEntities1()) { MembersData usr = db.MembersDatas.Where(u => u.EmailId == ml.EmailId).FirstOrDefault(); if (usr != null) { usr.CPassword = "******"; usr.Password = "******"; var fromemail = new MailAddress("*****@*****.**"); var toemail = new MailAddress(ml.EmailId); MailMessage mm = new MailMessage("*****@*****.**", ml.EmailId); mm.Subject = "New temporory password has been genrated for you"; mm.IsBodyHtml = true; mm.Body = "<div>Hello,</div> <div>We have genrated a new password for you .</div> <div>Password :Note@123<div>------</div><div> Regards,<div> NoteMarketplace</div>"; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.UseDefaultCredentials = false; smtp.Credentials = new NetworkCredential(fromemail.Address, "Note@tatva"); smtp.Send(mm); db.SaveChanges(); TempData["Success"] = "Email sent Successfully Done!"; return(RedirectToAction("ChangePass", "Auth")); } else { TempData["Success"] = "EmailId is wrong"; ModelState.AddModelError("", "EmailId is wrong"); return(RedirectToAction("Forgot", "Auth")); } } }
public ActionResult Rates(int noteid, RatesModel rt) { Rating r = new Rating(); using (projectEntities1 db = new projectEntities1()) { NoteDetail nm = db.NoteDetails.Where(u => u.Id == noteid).FirstOrDefault(); { r.Date = DateTime.Now; r.Description = rt.comment; r.BuyerId = 10; r.NoteId = noteid; r.Rate = Convert.ToInt32(Request.Form["rate"]); db.Ratings.Add(r); db.SaveChanges(); return(View()); } } }
public ActionResult UserProfile(UserProfileModal userProfile, HttpPostedFileBase dp) { if (Session["Id"] != null) { int id = Convert.ToInt32(Session["Id"].ToString()); using (projectEntities1 db = new projectEntities1()) { MembersData usr = db.MembersDatas.Where(u => u.Id == id).FirstOrDefault(); { string fileName = Path.GetFileName(dp.FileName); userProfile.uploaddp = "~/images/" + fileName; fileName = Path.Combine(Server.MapPath("~/images/"), fileName); dp.SaveAs(fileName); usr.AddLine1 = userProfile.add1; usr.Addline2 = userProfile.add2; usr.City = userProfile.city; usr.Collage = userProfile.collage; usr.Country = userProfile.country; usr.State = userProfile.state; usr.University = userProfile.university; usr.ZipCode = userProfile.zipcode; usr.DOB = userProfile.bdate; usr.PhoneNo = userProfile.phone; usr.IsDetailsSubmitted = true; usr.CPassword = "******"; usr.Gender = "Male"; usr.ProfilePicture = userProfile.uploaddp; db.SaveChanges(); return(View()); } } } else { return(View()); } }
public ActionResult Registration(MembersData md) { projectEntities1 db = new projectEntities1(); db.MembersDatas.Add(md); if (md.Password == md.CPassword) { db.SaveChanges(); var verifyUrl = "/Auth/ConfirmEmail?Email=" + md.EmailId; var link = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, verifyUrl); var fromemail = new MailAddress("*****@*****.**"); var toemail = new MailAddress(md.EmailId); MailMessage mm = new MailMessage("*****@*****.**", md.EmailId); mm.Subject = " Note Marketplace - Email Verification "; mm.IsBodyHtml = true; mm.Body = "<a'" + link + "'>" + link + "</a>"; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.UseDefaultCredentials = false; smtp.Credentials = new NetworkCredential(fromemail.Address, "Note@tatva"); smtp.Send(mm); TempData["Success"] = "Registration Successfully Done!"; return(RedirectToAction("Login", "Auth")); } else { TempData["Success"] = "Password and Confirm password miss match"; return(RedirectToAction("Registration", "Auth")); } }
public ActionResult aprovereq(int sellerid) { projectEntities1 db = new projectEntities1(); Buyer by = db.Buyers.Where(u => u.MemberId == sellerid).FirstOrDefault(); { by.IsActive = true; by.ApprovedDate = DateTime.Now; NoteDetail nm = db.NoteDetails.Where(u => u.Id == by.BookId).FirstOrDefault(); { Seller usr = db.Sellers.Where(u => u.ModifiedBy == by.MemberId).FirstOrDefault(); { usr.IsActive = true; usr.ApprovedDate = DateTime.Now; db.SaveChanges(); } } } return(RedirectToAction("Registration", "Auth")); }
public ActionResult AddNotes(AddNotesModel notesModel, HttpPostedFileBase dp, HttpPostedFileBase uploadnote, HttpPostedFileBase notepreview) { if (Session["Id"] != null) { int id = Convert.ToInt32(Session["Id"].ToString()); using (projectEntities1 db = new projectEntities1()) { MembersData usr = db.MembersDatas.Where(u => u.Id == id).FirstOrDefault(); { //projectEntities1 db = new projectEntities1(); NoteDetail notes = new NoteDetail(); ViewData["Category"] = db.Categories.ToList <Category>(); ViewData["Type"] = db.Types.ToList(); ViewData["Country"] = db.Countries.ToList(); notes.Category = notesModel.category; notes.Type = notesModel.type; notes.Country = notesModel.country; notes.OwnerId = id; notes.SellFor = false; notes.ReqDate = DateTime.Now; notes.ApprovedDate = DateTime.Now; notes.IsActive = true; notes.NoteTitle = notesModel.Title; notes.NoOfPages = notesModel.Noofpage; notes.Description = notesModel.Disc; notes.University = notesModel.instituename; notes.Course = notesModel.coursename; notes.CourseCode = notesModel.coursecode; notes.Professor = notesModel.professor; notes.SellPrice = notesModel.price; notes.Status = "Drafted"; string fileName = Path.GetFileName(dp.FileName); notesModel.dppath = "~/images/" + fileName; fileName = Path.Combine(Server.MapPath("~/images/"), fileName); dp.SaveAs(fileName); db.NoteDetails.Add(notes); string fileName1 = Path.GetFileName(uploadnote.FileName); notesModel.uploadpath = "~/images/" + fileName1; fileName = Path.Combine(Server.MapPath("~/images/"), fileName1); uploadnote.SaveAs(fileName); db.NoteDetails.Add(notes); string fileName2 = Path.GetFileName(notepreview.FileName); notesModel.notepath = "~/images/" + fileName2; fileName = Path.Combine(Server.MapPath("~/images/"), fileName2); notepreview.SaveAs(fileName); db.NoteDetails.Add(notes); notes.DisplayPic = notesModel.dppath; notes.Preview = notesModel.notepath; notes.note = notesModel.uploadpath; db.SaveChanges(); return(View()); } } } else { return(View()); } }
public ActionResult DownloadNotes(int noteid) { if (Session["Id"] != null) { int id1 = Convert.ToInt32(Session["Id"].ToString()); using (projectEntities1 db = new projectEntities1()) { MembersData usr = db.MembersDatas.Where(u => u.Id == id1).FirstOrDefault(); { NoteDetail nm = db.NoteDetails.Where(u => u.Id == noteid).FirstOrDefault(); if (nm.SellFor == true) { Seller sl = new Seller(); sl.MemberId = nm.OwnerId; Buyer by = new Buyer(); by.MemberId = id1; var fromemail = new MailAddress("*****@*****.**"); var toemail = new MailAddress(usr.EmailId); MailMessage mm = new MailMessage("*****@*****.**", usr.EmailId); mm.Subject = "Check" + usr.FirstName + " wants to purchase your notes "; mm.IsBodyHtml = true; mm.Body = "Hello" + usr.LastName + "," + "<div>We would like to inform you that" + usr.FirstName + " wants to purchase your notes. Please see Buyer Requests tab and allow download access to Buyer if you have received the payment from him." + "<div>Regards,<div>Notes Marketplace "; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.UseDefaultCredentials = false; smtp.Credentials = new NetworkCredential(fromemail.Address, "Note@tatva"); smtp.Send(mm); by.BookId = noteid; by.ApprovedDate = null; by.ReqDate = DateTime.Now; by.IsActive = false; db.Buyers.Add(by); sl.BookId = noteid; sl.IsActive = false; sl.MemberId = nm.OwnerId; sl.ModifiedBy = id1; sl.ReqDate = DateTime.Now; sl.ApprovedDate = DateTime.Now; db.Sellers.Add(sl); db.SaveChanges(); return(RedirectToAction("MyDownload", "NoteDetails")); } else { Seller sl = new Seller(); Buyer by = new Buyer(); by.MemberId = id1; by.BookId = noteid; by.ApprovedDate = DateTime.Now; by.ReqDate = DateTime.Now; by.IsActive = true; db.Buyers.Add(by); sl.BookId = noteid; sl.IsActive = true; sl.MemberId = nm.OwnerId; sl.ModifiedBy = id1; sl.ReqDate = DateTime.Now; sl.ApprovedDate = DateTime.Now; db.Sellers.Add(sl); db.SaveChanges(); TempData["Success"] = "Download sucsessfully"; return(RedirectToAction("MyDownload", "NoteDetails")); } } } } else { TempData["Success"] = "Please sign in/register to download this note."; return(RedirectToAction("Registration", "Auth")); } }