示例#1
0
        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"));
        }
示例#2
0
        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));
        }
示例#3
0
        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));
        }
示例#4
0
        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));
        }
示例#5
0
        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"));
        }
示例#6
0
        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));
        }
示例#7
0
        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"));
        }
示例#8
0
        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());
        }
示例#9
0
        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));
        }
示例#10
0
        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));
        }