public IActionResult AddToBasket(int id, [FromForm] int count) { logger.LogInformation($"Add good with id = {id} * count = {count}"); ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); shopEngine.AddGoodToBasket(id, GetUserID(), count); return(RedirectToAction("Index")); }
public IActionResult GoodEdit(int id) { ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); return(View("Good", new GoodWorker { Action = "Edit", GoodModel = shopEngine.GetGoodByID(id) })); }
public IActionResult Delete(int id) { var user = GetUserID(); logger.LogInformation($"Delete from basket for user = {user}"); ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); shopEngine.DeleteFromBasket(user, id); return(RedirectToAction("Basket", new { id = user })); }
public IActionResult Transaction() { int user = GetUser(); ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); var transaction = shopEngine.StartTransactionByBasket(user); return(View(new TransactionInformation { TransactionID = transaction.ActualID, UserID = user })); }
public IActionResult Adress(AdressModel adressModel) { if (ModelState.IsValid) { ShopEngine.ShopEngineService shopEngineService = new ShopEngine.ShopEngineService(); var result = shopEngineService.SetAdress(adressModel); if (!result) { ViewBag.Error = "Incorrect adress"; return(View(adressModel)); } return(RedirectToAction("Index", "Home")); } return(View(adressModel)); }
public IActionResult Good(GoodWorker goodWorker) { ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); var file = Request.Form.Files.FirstOrDefault(); string path = string.Empty; if (file != null && file.Length > 0) { path = $"images\\{GetUserLogin()}\\".Replace(".", "_").Replace("@", "_"); if (!string.IsNullOrEmpty(goodWorker.GoodModel.ImagePath)) { System.IO.File.Delete($"wwwroot\\{goodWorker.GoodModel.ImagePath}"); } var realPath = $"wwwroot\\{path}"; if (!Directory.Exists(realPath)) { Directory.CreateDirectory(realPath); } realPath += file.FileName; path += file.FileName; if (!System.IO.File.Exists(realPath)) { using (var stream = new FileStream(realPath, FileMode.OpenOrCreate)) file.CopyToAsync(stream); } } goodWorker.GoodModel.ImagePath = path; switch (goodWorker.Action.ToLower()) { case "new": shopEngine.AddGood(goodWorker.GoodModel); break; case "edit": shopEngine.UpdateGood(goodWorker.GoodModel); break; } return(RedirectToAction("Index")); }
public IActionResult History() { ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); return(View(shopEngine.DeliveryHistory(UserID))); }
public IActionResult Delivery([FromRoute] int id) { ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); shopEngine.DeliverySuccess(id); return(RedirectToAction("Index", "Delivery")); }
public IActionResult Index() { ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); return(View(shopEngine.DeliveryTransactions(UserID))); }
public IActionResult DeleteGood(int id) { ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); shopEngine.DeleteGood(id); return(RedirectToAction("Index")); }
public IActionResult GoodOpen(int id) { logger.LogInformation($"Open good with id = {id}"); ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); return(View(shopEngine.GetGoodByID(id))); }
public IActionResult Index() { ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); return(View(shopEngine.GetGoodsForCreator(GetUserID()))); }
public IActionResult Transactions() { ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); return(View(shopEngine.Transactions(GetUserID()))); }
public IActionResult Delivery(int id, bool success) { ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); shopEngine.DeliveryUser(id, success); return(RedirectToAction("Transactions")); }
public IActionResult CancelTransaction(int id) { ShopEngine.ShopEngineService shopEngineService = new ShopEngine.ShopEngineService(); shopEngineService.CancelTransactions(id); return(RedirectToAction("Transactions")); }
public IActionResult Basket(int id) { logger.LogInformation($"Open basket for user = {id}"); ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); return(View(shopEngine.GetBaskets(id))); }
public IActionResult Transaction(TransactionInformation transactionModel) { ShopEngine.ShopEngineService shopEngine = new ShopEngine.ShopEngineService(); shopEngine.TransactionInformation(transactionModel); return(RedirectToAction("Adress", new { id = transactionModel.TransactionID })); }
public IActionResult Index() { ShopEngine.ShopEngineService shopEngineService = new ShopEngine.ShopEngineService(); return(View(shopEngineService.GetGoods())); }