public ActionResult AddCustomre(Customer_Details custdetail, HttpPostedFileBase Image) { Customer_Details custlist = new Customer_Details(); custlist.FirstName = custdetail.FirstName; custlist.LastName = custdetail.LastName; custlist.Country = custdetail.Country; custlist.State = custdetail.State; // file1 to store image in binary formate and file2 to store path and url // we are checking file1 and file2 are null or not according to that different case are there if (Image != null && Image.ContentLength > 0) { string ImageName = System.IO.Path.GetFileName(Image.FileName); string physicalPath = Server.MapPath("~/img/" + ImageName); // save image in folder Image.SaveAs(physicalPath); custlist.Image = "img/" + ImageName; } //custlist.Image = custdetail.Image; dbcon.Customer_Details.Add(custlist); dbcon.SaveChanges(); return(RedirectToAction("Index", "Home")); }
/// <summary> /// Edit rows /// </summary> /// <param name="sender"></param> /// <param name="args"></param> public void dataGrid_RowValidated(object sender, Syncfusion.UI.Xaml.Grid.RowValidatedEventArgs args) { CustomerDatabaseEntities context = new CustomerDatabaseEntities(); Customer_Details newRecord = args.RowData as Customer_Details; if (sender == null) { return; } Customer_Details order = context.Customer_Details.First(i => i.customerID == newRecord.customerID); if (newRecord != null) { order.customerID = newRecord.customerID; order.email = newRecord.email; order.password = newRecord.password; order.firstName = newRecord.firstName; order.lastName = newRecord.lastName; order.address = newRecord.address; order.city = newRecord.city; order.state = newRecord.state; order.postcode = newRecord.postcode; order.dateOfBirth = newRecord.dateOfBirth; order.dateCreated = newRecord.dateCreated; } context.Entry(order).State = EntityState.Modified; context.SaveChanges(); context.Dispose(); }
public void SfDataGrid1_RowValidating(object sender, Syncfusion.UI.Xaml.Grid.RowValidatingEventArgs args) { CustomerDatabaseEntities context = new CustomerDatabaseEntities(); Customer_Details newRecord = args.RowData as Customer_Details; Customer_Details currentCustomer = new Customer_Details(); if (newRecord != null) { currentCustomer.customerID = newRecord.customerID; currentCustomer.email = newRecord.email; currentCustomer.password = newRecord.password; currentCustomer.firstName = newRecord.firstName; currentCustomer.lastName = newRecord.lastName; currentCustomer.address = newRecord.address; currentCustomer.phoneNumber = newRecord.phoneNumber; currentCustomer.city = newRecord.city; currentCustomer.state = newRecord.state; currentCustomer.postcode = newRecord.postcode; currentCustomer.dateOfBirth = newRecord.dateOfBirth; currentCustomer.dateCreated = newRecord.dateCreated; } using (context) { context.Customer_Details.Add(currentCustomer); context.SaveChanges(); context.Dispose(); } }
public ActionResult editcustomer(int id) { Customer_Details custlist = new Customer_Details(); Customer_Details client = dbcon.Customer_Details.Where(x => x.ID == id).FirstOrDefault(); custlist.FirstName = client.FirstName; custlist.LastName = client.LastName; custlist.Country = client.Country; custlist.State = client.State; custlist.Image = client.Image; int co_id = Convert.ToInt32(client.Country); var countrylist = from p in dbcon.CountryMasters select new { p.CountryID, p.Country_Name, }; var countrylistx = countrylist.ToList().Select(c => new SelectListItem { Text = c.Country_Name.ToString(), Value = c.CountryID.ToString(), Selected = (c.CountryID == co_id) }).ToList(); ViewBag.viewcountrylist = countrylistx; var Statelist = from p in dbcon.StateMasters select new { p.StateID, p.StateName, }; var Statelistx = Statelist.ToList().Select(c => new SelectListItem { Text = c.StateName.ToString(), Value = c.StateID.ToString(), }).ToList(); ViewBag.viewstatelist = Statelistx; return(View(custlist)); }
public async Task <IActionResult> Edit(int id, [Bind("Customer_Id,FullName,Address,City,Phone_Number")] Customer_Details customer_Details) { if (id != customer_Details.Customer_Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer_Details); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Customer_DetailsExists(customer_Details.Customer_Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer_Details)); }
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 void Deletecustomer(int id) { Customer_Details objclient = dbcon.Customer_Details.Find(id); dbcon.Customer_Details.Remove(objclient); dbcon.SaveChanges(); }
public ActionResult DeleteConfirmed(int id) { Customer_Details customer_Details = db.Customer_Details.Find(id); db.Customer_Details.Remove(customer_Details); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Customer_Name,Customer_Gender,Customer_DateOfBirth,Customer_MobileNumber,Customer_EmailId,Customer_BillingAddress,Customer_City,Cusromer_State,Customer_Pincode,Customer_UserName,Customer_Password,Customer_ImagePath,Customer_ImageName,Customer_ActivationDate")] Customer_Details customer_Details) { if (ModelState.IsValid) { db.Entry(customer_Details).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer_Details)); }
public ActionResult Edit([Bind(Include = "Customer_Id,Company_Id,Name,Email,Mobile,Mobile1,Address,City,State,Country,Created_By,Modified_By,Date_Created,Date_Modified")] Customer_Details customer_Details) { if (ModelState.IsValid) { db.Entry(customer_Details).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Company_Id = new SelectList(db.Company_Details, "Company_Id", "Name", customer_Details.Company_Id); return(View(customer_Details)); }
public async Task <IActionResult> Create([Bind("Customer_Id,FullName,Address,City,Phone_Number")] Customer_Details customer_Details) { if (ModelState.IsValid) { _context.Add(customer_Details); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customer_Details)); }
public ActionResult Edit([Bind(Include = "Id,Email,Password,Password_Hash,Security_Stamp,Phone_Number,Aadhar_Number,Is_Deleted,Create_Time_Stamp,Update_Time_Stamp")] Customer_Details customer_Details) { if (ModelState.IsValid) { db.Entry(customer_Details).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Id = new SelectList(db.Customer_Details, "Id", "Email", customer_Details.Id); ViewBag.Id = new SelectList(db.Customer_Details, "Id", "Email", customer_Details.Id); return(View(customer_Details)); }
public HttpResponseMessage AddCustomer(Customer_Details customerDetails) { try { objBal.AddCustomer(customerDetails); return(Request.CreateResponse(HttpStatusCode.Created, customerDetails)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message)); } }
public ActionResult Register(Customer_Details customer_Details) { if (ModelState.IsValid) { dbContext.customers.Add(customer_Details); dbContext.SaveChanges(); return(RedirectToAction("Login", "Customer_Details")); } else { return(View(customer_Details)); } }
// GET: Customer/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Customer_Details customer_Details = db.Customer_Details.Find(id); if (customer_Details == null) { return(HttpNotFound()); } return(View(customer_Details)); }
public ActionResult EditProfile(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Customer_Details sd = Db.Customer_Details.Find(id); if (sd == null) { return(HttpNotFound()); } return(View(sd)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Customer_Details customer_Details = db.Customer_Details.Find(id); if (customer_Details == null) { return(HttpNotFound()); } ViewBag.Company_Id = new SelectList(db.Company_Details, "Company_Id", "Name", customer_Details.Company_Id); return(View(customer_Details)); }
private void getSODetails() { if (txtSearchInput.Text.Trim() != "") { var ds = SO_Header.RetrieveData(oCon, txtSearchInput.Text, false); txtSONumber.Text = ds[0].SO_Number; var dsCustomer = Customer_Details.RetrieveData(oCon, ds[0].idCustomer, ""); txtCustomerCode.Text = dsCustomer[0].Customer_Code; txtReseller.Text = dsCustomer[0].Company_Name; } else { HttpContext.Current.Response.Write("<script>alert(" + ControlChars.Quote + "Please enter SO Number to search" + ControlChars.Quote + ");</script>"); } }
public ActionResult Index(int?id) { if (id != null) { Customer_Details cd = db.Customer_Details.Find(id); var viewmodel = new Customer_Details_ViewModel { Email = cd.Email, Password = cd.Password, Phone_Number = cd.Phone_Number, Aadhar_Number = cd.Aadhar_Number }; return(View(viewmodel)); } return(View()); }
// GET: User/Edit/5 public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Customer_Details customer_Details = db.Customer_Details.Find(id); if (customer_Details == null) { return(HttpNotFound()); } ViewBag.Id = new SelectList(db.Customer_Details, "Id", "Email", customer_Details.Id); ViewBag.Id = new SelectList(db.Customer_Details, "Id", "Email", customer_Details.Id); return(View(customer_Details)); }
//3.4)This method is used to add Customers public bool AddCustomer(Customer_Details customerDetails) { bool flag = false; int i = 0; using (MSMSDBEntities db = new MSMSDBEntities()) { db.Customer_Details.Add(customerDetails); i += db.SaveChanges(); if (i > 0) { return(true); } } return(flag); }
public PartialViewResult CreatePartial(int?id) { HttpCookie myCookie = Request.Cookies["inventoryCookie"]; string Company_Id = string.Empty; if (!string.IsNullOrEmpty(myCookie.Values["Company_Id"])) { Company_Id = myCookie.Values["Company_Id"].ToString(); } Customer_Details customer_ = new Customer_Details(); if (id != null) { customer_ = db.Customer_Details.Where(c => c.Customer_Id == id).FirstOrDefault(); } return(PartialView(customer_)); }
public JsonResult EditProfile(FormCollection Form, Customer_Details_ViewModel cus) { var employeeId = Session["employeeId"] != null?Convert.ToInt32(Session["employeeId"]) : 0; // Customer_Details cus = new Customer_Details(); long id = cus.Id; cus.Aadhar_Number = Form["Aadhar_Number"]; cus.Email = Form["Email"]; cus.Password = Form["Password"]; cus.Phone_Number = long.Parse(Form["Phone_Number"]); Customer_Details appointment = db.Customer_Details.Find(employeeId); db.SP_UpdateCustomer(id, cus.Email, cus.Password, cus.Phone_Number, cus.Aadhar_Number); db.SaveChanges(); return(Json(cus, JsonRequestBehavior.AllowGet)); }
public ActionResult Login(Customer_Details customer) { var validUser = dbContext.customers.SingleOrDefault(u => u.sEmail_ID == customer.sEmail_ID && u.sPassword == customer.sPassword); if (validUser != null) { //FormsAuthentication.SetAuthCookie(customer.sEmail_ID, false); return(RedirectToAction("Index", "Loandetail")); } else { //bootbox.alert("Your message here…"); ModelState.AddModelError("", "The username or password is invalid"); } return(View(customer)); }
public ActionResult Index(int?id) { var dc = from c in db.Customer_Details where c.Is_Deleted == false select c; if (id != null) { Customer_Details cd = db.Customer_Details.Find(id); var viewmodel = new Customer_Details_ViewModel { Email = cd.Email, Password = cd.Password, Phone_Number = cd.Phone_Number, Aadhar_Number = cd.Aadhar_Number }; return(View(viewmodel)); } return(View()); }
// GET: Appointments/Edit/5 public ActionResult Edit(long?id) { var employeeId = Session["employeeId"] != null?Convert.ToInt32(Session["employeeId"]) : 0; if (employeeId == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Customer_Details appointment = db.Customer_Details.Find(employeeId); //var cd = from s in db.Customer_Details where s.Id == employeeId select s.Create_Time_Stamp; if (appointment == null) { return(HttpNotFound()); } return(View(appointment)); }
public ActionResult Create(int?id, Customer_Details_ViewModel cv) { Customer_Details cd = new Customer_Details(); cd.Email = cv.Email; cd.Password = cv.Password; cd.Phone_Number = cv.Phone_Number; cd.Aadhar_Number = cv.Aadhar_Number; if (id == null) { db.SP_NewUser(cd.Email, cd.Password, cd.Phone_Number, cd.Aadhar_Number); } else { db.SP_UpdateCustomer(id, cd.Email, cd.Password, cd.Phone_Number, cd.Aadhar_Number); } db.SaveChanges(); return(RedirectToAction("Home")); }
public ActionResult Register(Customer_Details customer) { try { if(ModelState.IsValid) { if(customer!=null) { DB.Customer_Details.Add(customer); DB.SaveChanges(); return RedirectToAction("Customer_Login"); } } } catch(Exception ex) { ViewBag.Message = ex.Message; } return View(); }
public ActionResult Edit(Customer_Details_ViewModel appointment) { //if (ModelState.IsValid) //{ Customer_Details custom = new Customer_Details(); long id = appointment.Id; custom.Email = appointment.Email; custom.Password = appointment.Password; custom.Phone_Number = appointment.Phone_Number; custom.Aadhar_Number = appointment.Aadhar_Number; custom.Update_Time_Stamp = DateTime.Now; // db.Entry(custom).State = EntityState.Modified; db.SP_UpdateCustomer(id, custom.Email, custom.Password, custom.Phone_Number, custom.Aadhar_Number); db.SaveChanges(); TempData["message"] = "Your Message"; return(RedirectToAction("SendMessage")); //return View("Home"); //} // return View(appointment); }
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(); }