public ActionResult AddConfirmation(AddSaleBm addSaleBm) { var cookie = this.Request.Cookies.Get("sessionId"); if (cookie == null || !AuthenticationManager.IsAuthenticated(cookie.Value)) { return(this.RedirectToAction("Login", "Users")); } this.service.AddSale(addSaleBm); return(this.RedirectToAction("All", "Sales")); }
public ActionResult AddConfirmation(AddSaleConfirmationViewModel salesConfirmVm) { var cookie = this.Request.Cookies.Get("sessionId"); if (cookie == null || !AuthenticationManager.IsAuthenticated(cookie.Value)) { return(this.RedirectToAction("Login", "Users")); } return(this.View(salesConfirmVm)); }
public ActionResult AddSales() { HttpCookie cookie = this.Request.Cookies.Get("sessionId"); if (cookie == null || !AuthenticationManager.IsAuthenticated(cookie.Value)) { return(this.RedirectToAction("Login", "Users")); } AddSalesViewModel addSalesVm = service.GenerateAddSalesForm(); return(this.View(addSalesVm)); }
public ActionResult Review(SaleReviewVm vm) { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticationManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("Login", "Users")); } var user = AuthenticationManager.GetUser(httpCookie.Value); ViewBag.Username = user.Username; return(this.View(vm)); }
public ActionResult Review([Bind(Include = "CustomerId, CarId, Discount")] SaleReviewBm model) { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticationManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("Login", "Users")); } var user = AuthenticationManager.GetUser(httpCookie.Value); ViewBag.Username = user.Username; this.service.AddSaleFromBm(model, user.Id); return(this.RedirectToAction("All", "Sales")); }
public ActionResult Add() { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticationManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("Login", "Users")); } var user = AuthenticationManager.GetUser(httpCookie.Value); ViewBag.Username = user.Username; var viewModel = this.service.GetAddSaleVm(); return(this.View(viewModel)); }
public ActionResult Delete(int id) { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticationManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("Login", "Users")); } var user = AuthenticationManager.GetUser(httpCookie.Value); ViewBag.Username = user.Username; this.service.DeleteSupplier(id, user.Id); return(this.RedirectToAction("All", "Suppliers")); }
public ActionResult Add([Bind(Include = "Name, IsImporter")] AddSupplierBm model) { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticationManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("Login", "Users")); } var user = AuthenticationManager.GetUser(httpCookie.Value); ViewBag.Username = user.Username; if (this.ModelState.IsValid) { this.service.AddSupplierFromBm(model, user.Id); return(this.RedirectToAction("All", "Suppliers")); } return(this.View()); }
public ActionResult Add([Bind(Include = "CustomerId, CarId, Discount")] AddSaleBm model) { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticationManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("Login", "Users")); } var user = AuthenticationManager.GetUser(httpCookie.Value); ViewBag.Username = user.Username; if (this.ModelState.IsValid) { var saleReviewVm = this.service.GetSaleReviewVm(model); return(this.RedirectToAction("Review", saleReviewVm)); } var viewModel = this.service.GetAddSaleVm(); return(this.View(viewModel)); }
public ActionResult Edit([Bind(Include = "Id, Name")] EditSupplierBm model) { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticationManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("Login", "Users")); } var user = AuthenticationManager.GetUser(httpCookie.Value); ViewBag.Username = user.Username; if (this.ModelState.IsValid) { this.service.EditSupplier(model, user.Id); return(this.RedirectToAction("All", "Suppliers")); } var vm = this.service.GetEditSupplierVm(model.Id); return(this.View(vm)); }