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); }
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); }
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); }
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; } }
public void Save(User user) { base.Context().GetCollection<User>(User.COLLECTION_NAME).InsertOneAsync(user); }
public void Update(User user) { UserDAO.Update(user); }
public void Save(User user) { UserDAO.Save(user); }
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); }