コード例 #1
0
        public ActionResult Delete(int id)
        {
            var httpCookie = this.Request.Cookies.Get("sessionId");

            if (httpCookie == null || !AuthenticationManager.IsAuthenticated(httpCookie.Value))
            {
                return(RedirectToAction("All"));
            }
            DeleteSupplierVm vm = this.service.GetDeleteSupplier(id);

            return(this.View(vm));
        }
コード例 #2
0
        public ActionResult Delete([Bind(Include = "Id")] DeleteSupplierBm bind)
        {
            var httpCookie = this.Request.Cookies.Get("sessionId");

            if (httpCookie == null || !AuthenticationManager.IsAuthenticated(httpCookie.Value))
            {
                return(RedirectToAction("All"));
            }

            if (!ModelState.IsValid)
            {
                DeleteSupplierVm vm = this.service.GetDeleteSupplier(bind.Id);
                return(this.View(vm));
            }
            User user = AuthenticationManager.GetAuthenticatedUser(httpCookie.Value);

            this.service.DeleteSupplier(bind, user.Id);
            return(this.RedirectToAction("All"));
        }