public void CreateTest() { o = ProfileObjectFactory.Create(id, name, location, gender, birthDay, occupation, aboutText, profileImage); validateResults(id, name, location, gender, birthDay, occupation, aboutText, profileImage); }
public async Task <IActionResult> Create(IFormFile avatarFile, [Bind(properties)] ProfileViewModel c) { if (!ModelState.IsValid) { return(View(c)); } var extension = "." + avatarFile.FileName.Split('.')[avatarFile.FileName.Split('.').Length - 1]; string fileName = GetUniqueID() + extension; var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\images\\" + GetCurrentUserId(), fileName); var isCorrectImage = await _imageHandler.UploadImage(avatarFile, path); if (!isCorrectImage) { return(View(c)); } var o = ProfileObjectFactory.Create(GetCurrentUserId(), c.Name, c.Location, c.Gender, c.BirthDay, c.Occupation, c.AboutText, fileName); await _profileRepository.AddObject(o); return(RedirectToAction(nameof(Details))); }