public async Task <IActionResult> Create([FromBody] CreateBnkseekDTO resource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (resource == null) { return(BadRequest()); } // TODO Make a catch exception if apiResources is NULL // ? Trim trailing spaces from char fields // ? url: https://community.dynamics.com/gp/b/gpdynland/archive/2017/06/10/asp-net-core-and-ef-core-with-dynamics-gp-trim-trailing-spaces-from-char-fields resource = TrimStrings.TrimProps(resource); var created = _mapper.Map <CreateBnkseekDTO, BnkseekEntity>(resource); created.DT_IZM = DateTime.Today; // ? Save changes to the DB _unitOfWork.Bnkseek.AddAsync(created); await _unitOfWork.CompleteAsync(); return(Ok(resource)); }
public async Task <IActionResult> Update(string vkey, [FromBody] SaveBnkseekDTO resource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (resource == null) { return(BadRequest()); } // TODO Make a catch exception if apiResources is NULL // ? Trim trailing spaces from char fields // ? url: https://community.dynamics.com/gp/b/gpdynland/archive/2017/06/10/asp-net-core-and-ef-core-with-dynamics-gp-trim-trailing-spaces-from-char-fields resource = TrimStrings.TrimProps(resource); var decodedVKEY = _decoder.FromBase64.Decode(vkey); var source = await _unitOfWork.Bnkseek.GetByVKEYAsync(decodedVKEY, true); var updated = _mapper.Map( source: resource, destination: source ); updated.DT_IZM = DateTime.Today; // ? Save changes to the DB _unitOfWork.Bnkseek.Update(updated); await _unitOfWork.CompleteAsync(); return(Ok(resource)); }
public async Task <IActionResult> Create([FromBody] SaveBNKSEEKResource newRecord) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (newRecord == null) { return(BadRequest()); } // TODO Make a catch exception if apiResources is NULL // ? Trim trailing spaces from char fields // ? url: https://community.dynamics.com/gp/b/gpdynland/archive/2017/06/10/asp-net-core-and-ef-core-with-dynamics-gp-trim-trailing-spaces-from-char-fields newRecord = TrimStrings.TrimProps <SaveBNKSEEKResource>(newRecord); var created = mapper.Map <SaveBNKSEEKResource, BNKSEEKEntity>(newRecord); created.DT_IZM = DateTime.Today; // ? Save changes to the DB repository.AddAsync(created); await unitOfWork.CompleteAsync(); return(Ok(newRecord)); }
public async Task <IActionResult> Update(string vkey, [FromBody] SaveBNKSEEKResource record) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (record == null) { return(BadRequest()); } // TODO Make a catch exception if apiResources is NULL // ? Trim trailing spaces from char fields // ? url: https://community.dynamics.com/gp/b/gpdynland/archive/2017/06/10/asp-net-core-and-ef-core-with-dynamics-gp-trim-trailing-spaces-from-char-fields record = TrimStrings.TrimProps <SaveBNKSEEKResource>(record); var decodedVKEY = converter.Convert(vkey); var source = await repository.GetByVKEYAsync(decodedVKEY, true); var updated = mapper.Map <SaveBNKSEEKResource, BNKSEEKEntity>( source: record, destination: source ); updated.DT_IZM = DateTime.Today; // ? Save changes to the DB repository.Update(updated); await unitOfWork.CompleteAsync(); return(Ok(record)); }
public async Task <IEnumerable <UerDTO> > Index() { var entitis = await _unitOfWork.UER.GetAllAsync(); var resources = _mapper.Map <IEnumerable <UerEntity>, IEnumerable <UerDTO> >(entitis); // ? Trim trailing spaces from char fields // ? url: https://community.dynamics.com/gp/b/gpdynland/archive/2017/06/10/asp-net-core-and-ef-core-with-dynamics-gp-trim-trailing-spaces-from-char-fields return(TrimStrings.TrimProps(resources)); }
public async Task <IEnumerable <UERResource> > Index() { var entitis = await repository.GetAllAsync(); var apiResources = mapper.Map <List <UEREntity>, List <UERResource> >(entitis); // ? Trim trailing spaces from char fields // ? url: https://community.dynamics.com/gp/b/gpdynland/archive/2017/06/10/asp-net-core-and-ef-core-with-dynamics-gp-trim-trailing-spaces-from-char-fields apiResources = TrimStrings.TrimProps(apiResources).ToList(); return(apiResources); }
public async Task <IActionResult> GetById(string VKEY) { var decodedVKEY = _decoder.FromBase64.Decode(VKEY); var entity = await _unitOfWork.UER.GetByVKEYAsync(decodedVKEY, true); if (entity == null) { return(NotFound()); } var resource = _mapper.Map <UerEntity, UerDTO>(entity); // ? Trim trailing spaces from char fields // ? url: https://community.dynamics.com/gp/b/gpdynland/archive/2017/06/10/asp-net-core-and-ef-core-with-dynamics-gp-trim-trailing-spaces-from-char-fields return(Ok(TrimStrings.TrimProps(resource))); }
public async Task <QueryResult <BnkseekDTO> > Index(QueryOject queryOject) { var queryResult = await _unitOfWork.Bnkseek.GetByQueryAsync(queryOject, true); if (queryResult == null) { return(null); } var resorces = _mapper.Map <QueryResult <BnkseekEntity>, QueryResult <BnkseekDTO> >(queryResult); // ? Trim trailing spaces from char fields // ? More info: https://community.dynamics.com/gp/b/gpdynland/archive/2017/06/10/asp-net-core-and-ef-core-with-dynamics-gp-trim-trailing-spaces-from-char-fields resorces.Items = TrimStrings.TrimProps(resorces.Items); return(resorces); }
public async Task <IEnumerable <BNKSEEKResource> > Index() { var records = await repository.GetAllAsync(true); if (records == null) { return(null); } var apiResources = mapper.Map <List <BNKSEEKEntity>, List <BNKSEEKResource> >(records.Take(5).ToList()); // TODO Make a catch exception if apiResources is NULL // ? Trim trailing spaces from char fields url: https://community.dynamics.com/gp/b/gpdynland/archive/2017/06/10/asp-net-core-and-ef-core-with-dynamics-gp-trim-trailing-spaces-from-char-fields apiResources = TrimStrings.TrimProps(apiResources).ToList(); return(apiResources); }
public async Task <IActionResult> GetById(string VKEY) { var decodedVKEY = converter.Convert(VKEY); var entity = await repository.GetByVKEYAsync(decodedVKEY, true); if (entity == null) { return(NotFound()); } var apiResource = mapper.Map <UEREntity, UERResource>(entity); // ? Trim trailing spaces from char fields // ? url: https://community.dynamics.com/gp/b/gpdynland/archive/2017/06/10/asp-net-core-and-ef-core-with-dynamics-gp-trim-trailing-spaces-from-char-fields apiResource = TrimStrings.TrimProps <UERResource>(apiResource); return(Ok(apiResource)); }
public async Task <IActionResult> Details(string VKEY) { var decodedVKEY = _decoder.FromBase64.Decode(VKEY); var entity = await _unitOfWork.Bnkseek.GetByVKEYAsync(decodedVKEY, true); if (entity == null) { return(NotFound()); } var resource = _mapper.Map <BnkseekEntity, SaveBnkseekDTO>(entity); // TODO Make a catch exception if apiResources is NULL // ? Trim trailing spaces from char fields // ? url: https://community.dynamics.com/gp/b/gpdynland/archive/2017/06/10/asp-net-core-and-ef-core-with-dynamics-gp-trim-trailing-spaces-from-char-fields resource = TrimStrings.TrimProps(resource); return(Ok(resource)); }