Ejemplo n.º 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"));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }