예제 #1
0
        public ActionResult Index(int userid)
        {
            var result  = (new UserRepository()).Get(userid);
            var usuario = APIFunctions.GetData <UserInformation>(JsonConvert.SerializeObject(result));

            return(View(APIFunctions.UserToUsuario(usuario)));
        }
예제 #2
0
 public object Add(UserInformation user)
 {
     try
     {
         if (!ValidateUser(user.Email, user.Nick))
         {
             return(APIFunctions.ErrorResult(JsonMessage.NotFound));
         }
         Usuario newuser = MyGymContext.DB.Usuario.Add(APIFunctions.UserToUsuario(user));
         MyGymContext.DB.SaveChanges();
         // Generamos la dieta
         //new DietRepository().CreateDiet(newuser.UsuarioID);
         return(APIFunctions.SuccessResult(newuser.UsuarioID, JsonMessage.Success));
     }
     catch (Exception ex)
     {
         return(APIFunctions.ErrorResult(ex.Message));
     }
 }