public void Add(TestModel test, IFormFile img) { test.ImageName = NameGenerator.GenerateUniqCode() + Path.GetExtension(img.FileName); string imagePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/img/testimages", test.ImageName); using (var stream = new FileStream(imagePath, FileMode.Create)) { img.CopyTo(stream); } _context.TestModels.Add(test); _context.SaveChanges(); }
public void InsertEducation(Education educatio) { _context.Educations.Add(educatio); _context.SaveChanges(); }