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