public async Task <Models.Muse.Chart> CancelChartChanges(Models.Muse.Chart item) { var entityToCancel = context.Entry(item); entityToCancel.CurrentValues.SetValues(entityToCancel.OriginalValues); entityToCancel.State = EntityState.Unchanged; return(item); }
public async Task <Models.Muse.Chart> CreateChart(Models.Muse.Chart chart) { OnChartCreated(chart); context.Charts.Add(chart); context.SaveChanges(); OnAfterChartCreated(chart); return(chart); }
partial void OnAfterChartCreated(Models.Muse.Chart item);
public async Task <Models.Muse.Chart> UpdateChart(string nendo, string genre, decimal?hyokaNum, string kyokuName, string authorName, decimal?hour, decimal?minute, decimal?second, decimal?member, decimal?fileSize, Models.Muse.Chart chart) { OnChartUpdated(chart); var itemToUpdate = context.Charts .Where(i => i.NENDO == nendo && i.GENRE == genre && i.HYOKA_NUM == hyokaNum && i.KYOKU_NAME == kyokuName && i.AUTHOR_NAME == authorName && i.HOUR == hour && i.MINUTE == minute && i.SECOND == second && i.MEMBER == member && i.FILE_SIZE == fileSize) .FirstOrDefault(); if (itemToUpdate == null) { throw new Exception("Item no longer available"); } var entryToUpdate = context.Entry(itemToUpdate); entryToUpdate.CurrentValues.SetValues(chart); entryToUpdate.State = EntityState.Modified; context.SaveChanges(); OnAfterChartUpdated(chart); return(chart); }
partial void OnChartUpdated(Models.Muse.Chart item);
partial void OnChartGet(Models.Muse.Chart item);
partial void OnAfterChartDeleted(Models.Muse.Chart item);