public ActionResult EditProfile([Bind(Include = "Customer_Id,Customer_Name,Customer_Email,Customer_State,Customer_Phone,Customer_City,Customer_Password")] Customer_Details cd, HttpPostedFileBase image) { if (image != null) { cd.Customer_Profile = new byte[image.ContentLength]; image.InputStream.Read(cd.Customer_Profile, 0, image.ContentLength); } else { int id = (int)Session["id"]; var img = Db.Customer_Details.Where(m => m.Customer_Id == id).Select(m => m.Customer_Profile).FirstOrDefault(); if (img != null) { cd.Customer_Profile = img; } } if (ModelState.IsValid) { cd.Customer_Id = (int)Session["id"]; Db.Entry(cd).State = EntityState.Modified; Db.SaveChanges(); return(RedirectToAction("Profile")); } return(View(cd)); }
public ActionResult SellerRegistration(Seller_Details sd, HttpPostedFileBase image) { House_Rental Db = new House_Rental(); if (image != null) { sd.Seller_Photo = new byte[image.ContentLength]; image.InputStream.Read(sd.Seller_Photo, 0, image.ContentLength); } if (ModelState.IsValid) { Db.Seller_Details.Add(sd); Db.SaveChanges(); } return(RedirectToAction("SellerLogin", "Home")); }
public ActionResult Registration(Customer_Details cd, HttpPostedFileBase image) { House_Rental Db = new House_Rental(); if (image != null) { cd.Customer_Profile = new byte[image.ContentLength]; image.InputStream.Read(cd.Customer_Profile, 0, image.ContentLength); } if (ModelState.IsValid) { Db.Customer_Details.Add(cd); Db.SaveChanges(); return(RedirectToAction("Login", "Home")); } else { return(View(cd)); } //SendMail(); }
public async Task <ActionResult> AddProperty(Property_Details pd, HttpPostedFileBase[] images) { if (ModelState.IsValid) { pd.Seller_Id = (int)Session["sellerid"]; Db.Property_Details.Add(pd); await Db.SaveChangesAsync(); int id = Db.Property_Details.Max(p => p.Property_ID); if (images.Length > 0) { foreach (var image in images) { if (image != null) { BinaryReader binary = new BinaryReader(image.InputStream); Property_Images pi = new Property_Images { Property_Id = id, Image = binary.ReadBytes((int)image.ContentLength) }; Db.Property_Images.Add(pi); } } Db.SaveChanges(); } } else { List <SelectListItem> li = new List <SelectListItem>(); li.Add(new SelectListItem { Text = "House", Value = "House" }); li.Add(new SelectListItem { Text = "Flat", Value = "Flat" }); ViewData["type"] = li; List <SelectListItem> bhk = new List <SelectListItem>(); bhk.Add(new SelectListItem { Text = "1Bhk", Value = "1BHK" }); bhk.Add(new SelectListItem { Text = "2Bhk", Value = "2BHK" }); bhk.Add(new SelectListItem { Text = "3Bhk", Value = "3BHK" }); bhk.Add(new SelectListItem { Text = "4Bhk", Value = "4BHK" }); bhk.Add(new SelectListItem { Text = "5Bhk", Value = "5BHK" }); ViewData["bhk"] = bhk; List <SelectListItem> facing = new List <SelectListItem>(); facing.Add(new SelectListItem { Text = "North", Value = "North" }); facing.Add(new SelectListItem { Text = "East", Value = "East" }); facing.Add(new SelectListItem { Text = "West", Value = "West" }); facing.Add(new SelectListItem { Text = "South", Value = "South" }); ViewData["facing"] = facing; List <SelectListItem> furnish = new List <SelectListItem>(); furnish.Add(new SelectListItem { Text = "Fully Furnished", Value = "Fully Furnished" }); furnish.Add(new SelectListItem { Text = "Semi Furnished", Value = "Semi Furnished" }); furnish.Add(new SelectListItem { Text = "Not Furnished", Value = "Not Furnished" }); ViewData["furnish"] = furnish; List <SelectListItem> tenant = new List <SelectListItem>(); tenant.Add(new SelectListItem { Text = "Family", Value = "Family" }); tenant.Add(new SelectListItem { Text = "Bacholer", Value = "Bacholer" }); tenant.Add(new SelectListItem { Text = "Family/Bacholer", Value = "Family/Bacholer" }); ViewData["tenant"] = tenant; List <SelectListItem> parking = new List <SelectListItem>(); parking.Add(new SelectListItem { Text = "Available", Value = "Available" }); parking.Add(new SelectListItem { Text = "Not Available", Value = "Not Available" }); ViewData["parking"] = parking; List <SelectListItem> status = new List <SelectListItem>(); status.Add(new SelectListItem { Text = "Available", Value = "Available" }); status.Add(new SelectListItem { Text = "Not Available", Value = "Not Available" }); ViewData["status"] = status; return(View(pd)); } return(RedirectToAction("Index")); }