public ActionResult DeleteConfirmed(int id) { CategoriesT categoriesT = db.CategoriesTs.Find(id); db.CategoriesTs.Remove(categoriesT); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CategorieID,CategorieName,CategorieNameAR,ImagePath")] CategoriesT categoriesT) { if (ModelState.IsValid) { db.Entry(categoriesT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categoriesT)); }
public ActionResult Create([Bind(Include = "CategorieID,CategorieName,CategorieNameAR,ImagePath")] CategoriesT categoriesT) { if (ModelState.IsValid) { db.CategoriesTs.Add(categoriesT); db.SaveChanges(); return(RedirectToAction("Indexx")); } return(View(categoriesT)); }
// GET: CategoriesMcv/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CategoriesT categoriesT = db.CategoriesTs.Find(id); if (categoriesT == null) { return(HttpNotFound()); } return(View(categoriesT)); }
public ActionResult DeleteConfirmed(int id, string msg) { OrderT orderT = db.OrderTs.Find(id); ProdectT prodect = db.ProdectTs.Find(orderT.ProdectID); UserT user = db.UserTs.Find(orderT.UserID); CategoriesT categories = db.CategoriesTs.Find(prodect.CategorieID); oldOrder old = new oldOrder(); old.OrderNumber = orderT.OrderID; old.UserID = user.UserID; old.FullName = user.FullName; old.UserName = user.UserName; old.Password = user.Password; old.Email = user.Email; old.Phone = user.Phone; old.Address = user.Address; old.City = user.City; old.State = user.State; old.Country = user.Country; old.CategorieID = categories.CategorieName; old.ProdectID = prodect.ProdectID; old.ProdectName = prodect.ProdectName; old.ProdectNameAR = prodect.ProdectNameAR; old.Descriotion = prodect.Descriotion; old.DescriotionAR = prodect.DescriotionAR; old.Price = prodect.Price; old.Rating = prodect.Rating; old.CancelMassage = msg; db.oldOrders.Add(old); db.OrderTs.Remove(orderT); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult SendEmail(string receiver, string subject, string message, string orderId) { try { if (ModelState.IsValid) { var senderEmail = new MailAddress("*****@*****.**", "AnsBedoor"); var receiverEmail = new MailAddress(receiver, "Receiver"); var password = "******"; var sub = subject; var body = message; SmtpClient Client = new SmtpClient("smtp.gmail.com", 587); Client.EnableSsl = true; Client.Timeout = 100000; Client.DeliveryMethod = SmtpDeliveryMethod.Network; Client.UseDefaultCredentials = false; Client.Credentials = new NetworkCredential(senderEmail.Address, password); MailMessage mailMessage = new MailMessage(senderEmail.Address, receiverEmail.Address, subject, message); mailMessage.IsBodyHtml = true; mailMessage.BodyEncoding = UTF8Encoding.UTF8; using (var mess = new MailMessage(senderEmail, receiverEmail) { Subject = subject, Body = body }) { Client.Send(mailMessage); } var i = Convert.ToInt32(orderId); OrderT orderT = db.OrderTs.Find(i); ProdectT prodect = db.ProdectTs.Find(orderT.ProdectID); UserT user = db.UserTs.Find(orderT.UserID); CategoriesT categories = db.CategoriesTs.Find(prodect.CategorieID); oldOrder old = new oldOrder(); old.OrderNumber = orderT.OrderID; old.UserID = user.UserID; old.FullName = user.FullName; old.UserName = user.UserName; old.Password = user.Password; old.Email = user.Email; old.Phone = user.Phone; old.Address = user.Address; old.City = user.City; old.State = user.State; old.Country = user.Country; old.CategorieID = categories.CategorieName; old.ProdectID = prodect.ProdectID; old.ProdectName = prodect.ProdectName; old.ProdectNameAR = prodect.ProdectNameAR; old.Descriotion = prodect.Descriotion; old.DescriotionAR = prodect.DescriotionAR; old.Price = prodect.Price; old.Rating = prodect.Rating; db.oldOrders.Add(old); db.OrderTs.Remove(orderT); db.SaveChanges(); return(RedirectToAction("Index", "OrdersMcv", null)); } } catch (Exception ex) { ViewBag.Error = "Some Error"; } return(View()); }