public async Task <ResponseModel> Delete(IdentificationTypeModel model) { ResponseModel response = new ResponseModel(); try { IdentificationType md = await _context.IdentificationTypeRepository.FirstOrDefaultAsync(m => m.Id == model.Id); if (!md.RowVersion.SequenceEqual(model.RowVersion)) { response.ResponseStatus = Core.CommonModel.Enums.ResponseStatus.OutOfDateData; return(response); } md.Deleted = true; md.UpdateBy = base.UserId; md.UpdateDate = DateTime.Now; _context.IdentificationTypeRepository.Update(md); await _context.SaveChangesAsync(); } catch (Exception ex) { throw ex; } return(response); }
public async Task <ResponseModel> Insert(IdentificationTypeModel model) { ResponseModel response = new ResponseModel(); try { IdentificationType md = new IdentificationType(); md.Name = model.Name; md.Precedence = model.Precedence; md.IsActive = model.IsActive; md.CreateBy = base.UserId; md.CreateDate = DateTime.Now; md.Deleted = false; await _context.IdentificationTypeRepository.AddAsync(md).ConfigureAwait(true); await _context.SaveChangesAsync(); } catch (Exception ex) { throw ex; } return(response); }
public async Task <IdentificationTypeModel[]> GetAllIdentificationTypes() { IdentificationTypeModel[] identificationTypes; using (var imisContext = new ImisDB()) { identificationTypes = await imisContext.TblIdentificationTypes .Select(it => IdentificationTypeModel.FromTblIdentificationTypes(it)) .ToArrayAsync(); } return(identificationTypes); }
public async Task <ResponseModel> Delete([FromBody] IdentificationTypeModel model) { var response = await _identificationTypeService.Delete(model); return(response); }