internal int SaveActivityLog(AgainstTheClock.ActivityLog activityLog) { ActivityLog activityLogRecord = Map(activityLog); dbContext.Entry(activityLogRecord).State = activityLogRecord.Id == 0 ? EntityState.Added : EntityState.Modified; dbContext.SaveChanges(); return(activityLogRecord.Id); }
private ActivityLog Map(AgainstTheClock.ActivityLog source) { ActivityLog result = source.Id != 0 ? GetActivityLogRecordById(source.Id) : new ActivityLog(); result.UserId = source.UserId; result.ActivityId = source.ActivityId; result.IsFinished = source.IsFinished; result.LinkToTask = source.LinkToTask; result.Notes = source.Notes; result.TimeData = source.TimeData.Ticks; return(result); }
private AgainstTheClock.ActivityLog Map(ActivityLog source) { AgainstTheClock.ActivityLog result = new AgainstTheClock.ActivityLog { Id = source.Id, ActivityId = source.ActivityId, IsFinished = source.IsFinished, LinkToTask = source.LinkToTask, Notes = source.Notes, TimeData = TimeSpan.FromTicks(source.TimeData), UserId = source.UserId }; return(result); }