예제 #1
0
        public JsonResult logOn(User user)
        {
            User logeduser = UserService.Logon(user.Email, user.Password);

            Session.Add("user", user);
            return Json(logeduser == null ? "fail" : logeduser.Id.ToString(), JsonRequestBehavior.AllowGet);
        }
예제 #2
0
파일: UserDAOImpl.cs 프로젝트: TheOld/LZADV
 public void Update(User user)
 {
     var filter = Builders<User>.Filter.Eq("_id", user.Id);
     var update = Builders<User>.Update
         .Set(s => s.Name, user.Name)
         .Set(x => x.Password, user.Password)
         .Set(x => x.Email, user.Email);
         //.Set(x => x.LastWrite, post.LastWrite)
         //.Set(x => x.Author, post.Author);
     base.Context().GetCollection<User>(User.COLLECTION_NAME).UpdateOneAsync(filter, update);
 }
예제 #3
0
        public JsonResult create(User user)
        {
            UserService.Save(user);

            //for (int i = 0; i < Request.Files.Count; i++)
            //{
            //    HttpPostedFileBase arquivo = Request.Files[i];
            //    //Suas validações ......
            //    //Salva o arquivo
            //    if (arquivo.ContentLength > 0)
            //    {
            //        var uploadPath = Server.MapPath("~/App_Data/Uploads");
            //        string caminhoArquivo = Path.Combine(@uploadPath, Path.GetFileName(user.Name + ".png"));
            //        arquivo.SaveAs(caminhoArquivo);
            //    }
            //}

            return Json(user, JsonRequestBehavior.AllowGet);
        }
예제 #4
0
파일: PostDAOImpl.cs 프로젝트: TheOld/LZADV
        public List<Post> loadInactive(User user, int page, String filter)
        {
            try
            {
                IMongoQueryable<Post> query = base.Context().GetCollection<Post>(Post.COLLECTION_NAME).AsQueryable();

                if (!String.IsNullOrEmpty(filter))
                {
                    filter = filter.ToLower();
                    query = query.Where(x => x.Title.ToLower().Contains(filter) || x.Content.ToLower().Contains(filter));

                }

                return query.Where(x => x.IsEnable == false && user.Id.Equals(x.Author)).Skip(page * 10).Take(10).ToList();
            }
            catch (Exception e)
            {
                return null;
            }
        }
예제 #5
0
파일: UserDAOImpl.cs 프로젝트: TheOld/LZADV
 public void Save(User user)
 {
     base.Context().GetCollection<User>(User.COLLECTION_NAME).InsertOneAsync(user);
 }
예제 #6
0
 public void Update(User user)
 {
     UserDAO.Update(user);
 }
예제 #7
0
 public void Save(User user)
 {
     UserDAO.Save(user);
 }
예제 #8
0
 public JsonResult Update(String _ID, User user)
 {
     Object result = null;
     try
     {
         user.Id = ObjectId.Parse(_ID);
         UserService.Update(user);
         result = "OK";
     }
     catch (Exception e)
     {
         result = new { error = "error", cause = e.Message };
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }