public ActionResult Create([Bind(Include = "StaticPageId,StaticPageName,StaticPageContent")] Staticpage staticpage) { if (ModelState.IsValid) { db.Staticpages.Add(staticpage); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(staticpage)); }
public ActionResult Create([Bind(Include = "ID,LocationName,Address,City,Latitude,Longitude,BusinessUnitName,CurrencyCode,InsertDate,UpdateDate,DeleteDate,IsDeleted")] Location location) { if (ModelState.IsValid) { location.InsertDate = DateTime.UtcNow; db.Locations.Add(location); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(location)); }
public ActionResult Create([Bind(Include = "Id,LocationID,Availability,InsertDate,UpdateDate,DeleteDate,IsDeleted,ChargerName")] Charger charger) { if (ModelState.IsValid) { charger.InsertDate = DateTime.UtcNow; db.Chargers.Add(charger); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LocationID = new SelectList(db.Locations, "ID", "LocationName", charger.LocationID); return(View(charger)); }
public ActionResult Create([Bind(Include = "Id,ChargerId,LocationId,ConnectorTypeId,ConnectorStatus,SMSCode,ConnectorUnId,Tariff,InsertDate,UpdateDate,DeleteDate,isDeleted")] Connector connector) { if (ModelState.IsValid) { connector.InsertDate = DateTime.UtcNow; db.Connectors.Add(connector); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ChargerId = new SelectList(db.Chargers, "Id", "ChargerName", connector.ChargerId); ViewBag.ConnectorTypeId = new SelectList(db.Connector_Types, "Id", "ConnectorName", connector.ConnectorTypeId); ViewBag.LocationId = new SelectList(db.Locations, "ID", "LocationName", connector.LocationId); return(View(connector)); }
public ActionResult register([Bind(Exclude = "IsEmailVerify,ActivationCode,IsEmailverify,resetPasswordCode,ResetCode")] Customer c) { if (ModelState.IsValid == true) { var isEmailAlreadyExists = db.Customers.Any(x => x.EmailAddress == c.EmailAddress); if (isEmailAlreadyExists) { ModelState.AddModelError("EmailAddress", "User with this email already exists"); return(View(c)); } else { c.RoleId = "User"; db.Customers.Add(c); int a = db.SaveChanges(); if (a > 0) { TempData["register"] = "<script>alert('register succefully !!')</script>"; ModelState.Clear(); return(RedirectToAction("Login")); } else { TempData["Noregister"] = "<script>alert('not register succefully !!')</script>"; } } } return(View()); }
public ActionResult Create([Bind(Include = "ServiceID,ServiceName,ServiceDescription,Accepted,InsertDate,UpdateDate,DeleteDate,isDeleted")] Service service) { if (ModelState.IsValid) { service.ServiceStatus = "Pending"; service.InsertDate = DateTime.UtcNow; db.Services.Add(service); try { db.SaveChanges(); } catch (System.Data.Entity.Validation.DbEntityValidationException e) { Console.WriteLine(e); } return(RedirectToAction("Index")); } return(View(service)); }
public ActionResult Index(string Password, string newPassword, string ConfirmPassword) { Customer objlogin = new Customer(); string EmailAddress = Session["UserEmail"].ToString(); var login = db.Customers.Where(u => u.EmailAddress.Equals(EmailAddress)).FirstOrDefault(); Console.WriteLine(login); if (login.Password == Password) { if (ConfirmPassword == newPassword) { login.ConfirmPassword = ConfirmPassword; login.Password = newPassword; db.Entry(login).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbEntityValidationException e) { Console.WriteLine(e); } TempData["msg"] = "<script>alert('Password has been changed successfully !!!');</script>"; return(RedirectToAction("Login", "Home")); } else { TempData["msg"] = "<script>alert('New password not match !!! Please check');</script>"; } } else { TempData["msg"] = "<script>alert('Old password not match !!! Please check entered old password');</script>"; } return(View()); }
public ActionResult Create([Bind(Include = "ID,FirstName,LastName,BusinessUnitID,EmailAddress,streetAddress,PostalCode,City,Country,InvoiceStreetAddress,InvoicePostalCode,InvoiceCity,InvoiceCountry,Site,Telephone,RoleId,InsertDate,UpdateDate,DeleteDate,IsDeleted,Password,resetPasswordCode,IsEmailverify,ActivationCode,ConfirmPassword")] Customer customer) { if (ModelState.IsValid) { customer.InsertDate = DateTime.UtcNow; db.Customers.Add(customer); try { db.SaveChanges(); } catch (System.Data.Entity.Validation.DbEntityValidationException e) { Console.WriteLine(e); } return(RedirectToAction("Index")); } ViewBag.BusinessUnitID = new SelectList(db.BusinessUnits, "ID", "BusinessUnitName", customer.BusinessUnitID); ViewBag.RoleId = new SelectList(db.Roles, "ID", "RoleName", customer.RoleId); return(View(customer)); }
public ActionResult Delete(Connector connector) { using (EVModelEntities entities = new EVModelEntities()) { Connector updatedConnector = (from c in entities.Connectors where c.Id == connector.Id select c).FirstOrDefault(); updatedConnector.DeleteDate = DateTime.UtcNow; updatedConnector.isDeleted = true; entities.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Delete(Location location) { using (EVModelEntities entities = new EVModelEntities()) { Location updatedLocation = (from c in entities.Locations where c.ID == location.ID select c).FirstOrDefault(); updatedLocation.DeleteDate = DateTime.UtcNow; updatedLocation.IsDeleted = true; entities.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Delete(Customer customer) { using (EVModelEntities entities = new EVModelEntities()) { Customer updatedCustomer = (from c in entities.Customers where c.ID == customer.ID select c).FirstOrDefault(); updatedCustomer.DeleteDate = DateTime.UtcNow; updatedCustomer.IsDeleted = true; entities.SaveChanges(); } return(RedirectToAction("Index")); }