public ActionResult CreateUserAdress(UserAdress userAdress) { userAdress.CreateDate = DateTime.Now; userAdress.CreateUserID = LoginUserID; userAdress.IsActive = true; userAdress.UserID = LoginUserID; db.UserAdress.Add(userAdress); db.SaveChanges(); return(RedirectToAction("AddresList")); }
public ActionResult Create([Bind(Include = "ID,ParentID,Name,IsActive,CreateDate,CreateUserID,UpdateDate,UpdateUserID")] Category category) { if (ModelState.IsValid) { db.Categories.Add(category); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Create([Bind(Include = "ID,Name,LastName,Email,Telephone,Password,TCKN,IsActive,IsAdmin,CreateDate,CreateUserID,UpdateDate,UpdateUserID")] User user) { if (ModelState.IsValid) { db.Users.Add(user); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Create([Bind(Include = "ID,Name,CategoryID,Brand,Model,ImageUrl,Description,Price,Tax,Discount,Stock,IsActive,CreateDate,CreateUserID,UpdateDate,UpdateUserID")] Product product) { if (ModelState.IsValid) { db.Products.Add(product); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "ID", "Name", product.CategoryID); return(View(product)); }
// GET: Basket public JsonResult AddProduct(int productID, int quantity) { db.Baskets.Add(new Core.Model.Entity.Basket { CreateDate = DateTime.Now, CreateUserID = LoginUserID, ProductID = productID, Quantity = quantity, UserID = LoginUserID }); var data = db.SaveChanges(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Create([Bind(Include = "ID,UserID,UserAdressID,StatusID,TotalProductPrice,TotalTaxPrice,TotalDiscount,TotalPrice,CreateDate,CreateUserID,UpdateDate,UpdateUserID")] Order order) { if (ModelState.IsValid) { db.Orders.Add(order); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StatusID = new SelectList(db.Statuses, "ID", "Name", order.StatusID); ViewBag.UserID = new SelectList(db.Users, "ID", "Name", order.UserID); ViewBag.UserAdressID = new SelectList(db.UserAdress, "ID", "Title", order.UserAdressID); return(View(order)); }
public ActionResult CreateLogin(User users) { try { users.CreateDate = DateTime.Now; users.CreateUserID = 1; users.IsActive = true; users.IsAdmin = false; db.Users.Add(users); db.SaveChanges(); return(Redirect("/")); } catch (Exception ex) { return(View()); } }