Beispiel #1
0
        /// <summary>
        /// Show view to edit the current account
        /// </summary>
        /// <returns>View|Redirect</returns>
        public ActionResult Edit()
        {
            CustomerDb dbCustomer    = new CustomerDb();
            var        claimIdentity = User.Identity as ClaimsIdentity;
            int        id            = Convert.ToInt32(claimIdentity.FindFirst(ClaimTypes.NameIdentifier).Value);

            if (id > 0)
            {
                Customer         customer         = dbCustomer.GetCustomerDetail(id);
                AccountViewModel accountViewModel = new AccountViewModel
                {
                    IdUser     = customer.IdUser,
                    FirstName  = customer.FirstName,
                    LastName   = customer.LastName,
                    Address    = customer.Address,
                    PostalCode = customer.PostalCode,
                    Town       = customer.Town,
                    Country    = customer.Country,
                    Email      = customer.Email,
                    Username   = customer.Username
                };

                return(View(accountViewModel));
            }

            return(RedirectToAction("Index", "Home"));
        }
Beispiel #2
0
        public ActionResult DeleteCustomer(int id)
        {
            CustomerDb dbCustomer = new CustomerDb();

            ModelState.Clear();
            return(View(dbCustomer.GetCustomerDetail(id)));
        }