public Error SaveError(Error error) { var state = error.Id == 0 ? EntityState.Added : EntityState.Modified; context.Entry(error).State = state; context.SaveChanges(); return(error); }
private Frequency createFrequencyOfLogDescription(string logDescription) { Frequency frequency = new Frequency() { LogDescription = logDescription, NumberOfEvents = 1 }; var state = EntityState.Added; context.Entry(frequency).State = state; context.SaveChanges(); return(frequency); }