Пример #1
0
 public FileUploadJsonResult Upload(HttpPostedFileBase Photo)
 {
     MembershipUser user = Membership.GetUser(HttpContext.User.Identity.Name);
     Guid guid = (Guid)user.ProviderUserKey;
     PredictionRepository repository = new PredictionRepository();
     PreMembership predictor = repository.GetMember(guid);
     Photo = Request.Files["Photo"];
     MemoryStream ms = new MemoryStream();
     using (Image img = new Bitmap(Image.FromStream(Photo.InputStream), 200, 200))
     {
         img.Save(ms, ImageFormat.Png);
     }
     predictor.Photo = ms.ToArray();
     UpdateModel(predictor);
     repository.Save();
     System.Threading.Thread.Sleep(1000);
     // ++
     return new FileUploadJsonResult { Data = new { message = "success" } };
     
     // ++
 }
Пример #2
0
 public ActionResult ChangeAccountInfo(string FirstName, string LastName, string Country)
 {
     MembershipUser user = Membership.GetUser(HttpContext.User.Identity.Name);
     Guid guid = (Guid)user.ProviderUserKey;
     PredictionRepository repository = new PredictionRepository();
     PreMembership predictor = repository.GetMember(guid);
     UpdateModel(predictor);
     repository.Save();
     return View("ChangeInfoSuccess");
 }
Пример #3
0
 public void changeAccount()
 {
     var firstname = Request.Form["FirstName"];
     var lastname = Request.Form["LastName"];
     var country = Request.Form["Country"];
     MembershipUser user = Membership.GetUser(HttpContext.User.Identity.Name);
     Guid guid = (Guid)user.ProviderUserKey;
     PredictionRepository repository = new PredictionRepository();
     PreMembership predictor = repository.GetMember(guid);
     if (predictor.FirstName == firstname && predictor.LastName == lastname && predictor.Country == country)
     {
         Response.Write("<div class='error'>You don't change any data.</div>");
     }
     else
     {
         UpdateModel(predictor);
         repository.Save();
         Response.Write("OK");
     }
 }