public async Task <ActionResult> Create(ICDDto item) { ICDDto icd = item; await _icdcrudService.Create(icd); return(null); }
public async Task Update(ICDDto dto) { try { var entity = await GetEntity(dto.Id); using (DHContext db = new DHContext()) { entity.Code = dto.Code; entity.Description = dto.Description; entity.Name = dto.Name; db.Entry(entity).State = EntityState.Modified; await db.SaveChangesAsync(); } } catch (Exception exc) { _logger.Error($"Failed update ICD {dto.Id} : {exc}"); } }
public async Task Create(ICDDto dto) { try { using (DHContext db = new DHContext()) { ICD entity = new ICD { Id = Guid.NewGuid(), Code = dto.Code, Description = dto.Description, Name = dto.Name }; db.ICDs.Add(entity); await db.SaveChangesAsync(); } } catch (Exception exc) { _logger.Error($"Failed create ICD : {exc}"); } }
public async Task <ActionResult> Update(ICDDto item) { await _icdcrudService.Update(item); return(null); }