public async Task <TEntity> UpdateAsync(TEntity value) { value.UpdatedDate = DateTime.Now; _context.Entry(value).State = EntityState.Modified; _context.SaveChanges(); await _context.SaveChangesAsync(); return(value); }
private static void CreateDatabase() { using (var context = new DocsManagerDbContext( new SqlConnection(TestDataBaseConnectionString))) { context.Database.Initialize(true); context.Database.Create(); var docBytes = Encoding.Default.GetBytes(DocHex); var docXBytes = Encoding.Default.GetBytes(DocxHex); var rtfBytes = Encoding.Default.GetBytes(RtfHex); context.Documents.Add(new Document() { FileSize = 100, CreatedBy = "test", CreatedDate = DateTime.Now, DocumentFile = docBytes, FileType = DocumentTypesEnum.Doc, FileName = "hello.doc" }); context.SaveChanges(); } }