public async Task <object> UpdateAsync <T>(string source, string id, dynamic item)
            where T : class, IEntity
        {
            var repo     = new EntityFrameworkRepository <T>(dbContext);
            var existing = await repo.FindAsync(e => e.Source == source && e.Id == id);

            if (existing == null || existing.Count() == 0)
            {
                throw new KeyNotFoundException($"Entity {typeof(T)} with source {source} and id {id} not found");
            }

            await repo.DeleteAsync(existing.First());

            var inItem = JsonConvert.DeserializeObject <T>(JsonConvert.SerializeObject(item));
            await repo.CreateAsync(inItem);

            return(inItem);
        }
 public async Task DeleteAsync <T>(T item)
     where T : class
 {
     var repo = new EntityFrameworkRepository <T>(dbContext);
     await repo.DeleteAsync(item);
 }
Example #3
0
 public async Task DeleteAsync(JobModel entity)
 {
     await _efRepository.DeleteAsync(entity);
 }
Example #4
0
 public async Task DeleteAsync(IPDetailsModel entity)
 {
     await _efRepository.DeleteAsync(entity);
 }