public TimeEntry Create(TimeEntry timeEntry) { TimeEntryRecord record = _context.TimeEntryRecords.Add(timeEntry.ToRecord()).Entity; _context.SaveChanges(); return(record.ToEntity()); }
public TimeEntry Update(long id, TimeEntry timeEntry) { TimeEntryRecord timeEntryRecord = _context.Find <TimeEntryRecord>(id); timeEntryRecord.UserId = timeEntry.UserId; timeEntryRecord.ProjectId = timeEntry.ProjectId; timeEntryRecord.Date = timeEntry.Date; timeEntryRecord.Hours = timeEntry.Hours; _context.Update(timeEntryRecord); _context.SaveChanges(); return(timeEntryRecord.ToEntity()); }
public TimeEntry Find(long id) { TimeEntryRecord timeEntryRecord = _context.TimeEntryRecords.AsNoTracking().Single(t => t.Id == id); return(timeEntryRecord.ToEntity()); }