예제 #1
0
        public ActionResult EditProfile(View_Profile model)
        {
            var user = UserBus.Find(model.Id);

            user.Address     = model.Address;
            user.PhoneNumber = model.PhoneNumber;
            user.FirstName   = model.FirstName;
            user.LastName    = model.LastName;
            UserBus.Edit(user);
            return(RedirectToAction("ViewProfile"));
        }
예제 #2
0
        public JsonResult SaveData(string strUser, string role)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            View_Profile         user       = serializer.Deserialize <View_Profile>(strUser);
            bool   status  = false;
            string message = string.Empty;
            //add new User if id = 0

            //update existing DB
            //save db
            var entity = UserBus.Find(user.Id);

            entity.FirstName   = user.FirstName;
            entity.LastName    = user.LastName;
            entity.Address     = user.Address;
            entity.PhoneNumber = user.PhoneNumber;
            var userRole = UserBus.UserRoleDetails(user.Id);

            userRole.RoleId = role;
            try
            {
                UserBus.Edit(entity);
                UserBus.RoleEdit(userRole);
                status = true;
            }
            catch (Exception ex)
            {
                status  = false;
                message = ex.Message;
            }

            return(Json(new
            {
                status = status,
                message = message
            }));
        }