public void SaveUser(ConferenceUsers conferenceUsers) { ConferenceUsers.Add(conferenceUsers); string zapis = JsonConvert.SerializeObject(ConferenceUsers.ToArray(), Formatting.Indented); System.IO.File.WriteAllText("File/MOCK_DATA.json", zapis); }
public ActionResult Index(ConferenceUsers conferenceUser, IFormFile avatar) { if (!ModelState.IsValid) { return(View(_conferenceDate)); } else { if (avatar != null) { var fileName = Path.Combine($"{_hostingEnviroment.WebRootPath}\\images\\avatarImages", Path.GetFileName(avatar.FileName)); avatar.CopyTo(new FileStream(fileName, FileMode.Create)); conferenceUser.Avatar = "/images/avatarImages/" + Path.GetFileName(avatar.FileName); } _conferenceDate.SaveUser(conferenceUser); return(RedirectToAction(nameof(Index))); } }
public void SaveUser(ConferenceUsers conferenceUsers) { ConferenceUsers.Add(conferenceUsers); }
public void SaveUser(ConferenceUsers conferenceUsers) { _context.Add(conferenceUsers); _context.SaveChanges(); }