public ActionResult Profil(int id = 0, string ad = "") { List <DB.Addresses> addresses = null; DB.Addresses currentAddress = new DB.Addresses(); if (id == 0) { id = base.CurrentUserId(); addresses = context.Addresses.Where(x => x.Member_Id == id).ToList(); if (!string.IsNullOrEmpty(ad)) { var guild = new Guid(ad); currentAddress = context.Addresses.FirstOrDefault(x => x.Id == guild); } } var user = context.Members.FirstOrDefault(x => x.Id == id); if (user == null) { return(RedirectToAction("index", "i")); } ProfilModels model = new ProfilModels() { Members = user, Addresses = addresses, CurrentAddress = currentAddress }; return(View(model)); }
public ActionResult ProfilEdit(ProfilModels models, HttpPostedFileBase Foto) { int id = CurrentUserId(); var updateMember = context.Members.FirstOrDefault(x => x.Id == id); if (Foto != null) { if (System.IO.File.Exists(Server.MapPath(updateMember.ProfileImageName))) { System.IO.File.Delete(Server.MapPath(updateMember.ProfileImageName)); } WebImage img = new WebImage(Foto.InputStream); FileInfo fotoinfo = new FileInfo(Foto.FileName); string newfoto = Guid.NewGuid().ToString() + fotoinfo.Extension; /*extension resim uzantısı*/ img.Resize(350, 350); img.Save("~/images/mi/" + newfoto); string filepath = "/images/mi/" + newfoto; updateMember.ProfileImageName = filepath; } updateMember.ModifiedDate = DateTime.Now; updateMember.Name = models.Members.Name; updateMember.Email = models.Members.Email; updateMember.Surname = models.Members.Surname; updateMember.Bio = models.Members.Bio; if (string.IsNullOrEmpty(models.Members.Password) == false) { updateMember.Password = models.Members.Password; } context.SaveChanges(); Session["Logonuser"] = (DB.Members)updateMember; return(RedirectToAction("Profil", "Account", new { id = CurrentUserId() })); }
public ActionResult Profil(int id = 0, string ad = "") { List <Adres> adresses = null; Adres currentAdres = new Adres(); if (id == 0) { id = base.CurrentUserId(); adresses = Context.Adres.Where(x => x.Member.Id == id).ToList(); if (string.IsNullOrEmpty(ad) == false) { var guid = new Guid(ad); currentAdres = Context.Adres.FirstOrDefault(x => x.Id == guid); } else { } } var user = Context.Members.FirstOrDefault(x => x.Id == id); if (user == null) { return(RedirectToAction("Index", "Home")); } ProfilModels model = new ProfilModels() { Members = user, Adres = adresses, CurrentAdres = currentAdres }; return(View(model)); }
public ActionResult ProfilEdit() { int id = base.CurrentUserId(); var user = context.Members.FirstOrDefault(x => x.Id == id); if (user == null) { return(RedirectToAction("index", "i")); } ProfilModels model = new ProfilModels() { Members = user }; return(View(model)); }
public ActionResult Profil(int id) { var user = context.Members.FirstOrDefault(x => x.Id == id); List <DB.Addresses> adress = context.Addresses.Where(x => x.Member_Id == id).ToList(); /*userin adresleri alındı*/ if (user == null) { return(RedirectToAction("Index", "i")); } ProfilModels model = new ProfilModels() { Members = user, Addresses = adress }; return(View(model)); }
public ActionResult ProfilEdit(ProfilModels model) { try { int id = CurrentUserId(); var updateMember = context.Members.FirstOrDefault(x => x.Id == id); updateMember.ModifiedDate = DateTime.Now; updateMember.Bio = model.Members.Bio; updateMember.Name = model.Members.Name; updateMember.Surname = model.Members.Surname; if (string.IsNullOrEmpty(model.Members.Password) == false) { updateMember.Password = model.Members.Password; } if (Request.Files != null && Request.Files.Count > 0) { var file = Request.Files[0]; if (file.ContentLength > 0) { var folder = Server.MapPath("~/images/upload"); var fileName = Guid.NewGuid() + ".jpg"; file.SaveAs(Path.Combine(folder, fileName)); var filePath = "images/upload/" + fileName; updateMember.ProfileImageName = filePath; } } context.SaveChanges(); return(RedirectToAction("Profil", "Account")); } catch (Exception ex) { ViewBag.MyError = ex.Message; int id = CurrentUserId(); var viewModel = new Models.Account.ProfilModels() { Members = context.Members.FirstOrDefault(x => x.Id == id) }; return(View(viewModel)); } }
public ActionResult ProfilEdit(ProfilModels model) { try { int id = CurrentUserId(); var updateMember = Context.Members.FirstOrDefault(x => x.Id == id); updateMember.OlusturmaTarihi = DateTime.Now; updateMember.Biografi = model.Members.Biografi; updateMember.Adı = model.Members.Adı; updateMember.Soyadı = model.Members.Soyadı; if (string.IsNullOrEmpty(model.Members.Password) == false) { updateMember.Password = model.Members.Password; } if (Request.Files != null && Request.Files.Count > 0) { var file = Request.Files[0]; if (file.ContentLength > 0) { var folder = Server.MapPath("~/images/uploads/"); var filename = Guid.NewGuid() + ".jpg"; file.SaveAs(Path.Combine(folder, filename)); var filePath = "~/images/uploads/" + filename; updateMember.ProfilResmi = filePath; } } Context.SaveChanges(); return(RedirectToAction("Profil", "Hesap")); } catch (Exception ex) { ViewBag.MyError = ex.Message; int id = CurrentUserId(); var viewmodel = new Models.Hesap.ProfilModels() { Members = Context.Members.FirstOrDefault(x => x.Id == id) }; return(View(viewmodel)); } }
//recuperation des données public ActionResult ProfilDetails(string id) { ServiceProfil cs = new ServiceProfil(); User C = cs.GetById(id); ProfilModels p = new ProfilModels() { Prenom = C.Prenom, Nom = C.Nom, Sexe = C.Sexe, DateNaissance = C.DateNaissance, Email = C.Email, Pays = C.Pays, Ville = C.Ville, Rue = C.Rue, image = C.image }; return(View(p)); }
public ActionResult Profil(int id = 0) { if (id == 0) { id = base.CurrentUserId(); System.Diagnostics.Debug.WriteLine("iç : " + id); } var user = emlakDBEntities.Members.FirstOrDefault(x => x.Id == id); if (user == null) { return(RedirectToAction("index", "i")); } ProfilModels model = new ProfilModels() { Members = user }; System.Diagnostics.Debug.WriteLine("Aa : " + user.Id); return(View(model)); }
public ActionResult Profil(int id = 0) { List <DB.Addresses> addresses = null; if (id == 0) { id = base.CurrentUserId(); addresses = context.Addresses.Where(x => x.Member_Id == id).ToList(); } var user = context.Members.FirstOrDefault(x => x.Id == id); if (user == null) { return(RedirectToAction("index", "i")); } ProfilModels model = new ProfilModels() { Members = user, Addresses = addresses }; return(View(model)); }