public async Task <string> GenerateDobiId() { try { var totalDobi = await _dobiRepository.GetDobiCount(); var newDobiId = (totalDobi + 1).ToString().PadLeft(DobiIdLength, '0'); var dobiIdTermplate = Constants.DOBIID; var dobiId = dobiIdTermplate.Replace("__ID__", newDobiId); return(dobiId); } catch (Exception ex) { throw new Exception("Error in generating dobi id" + ex); } }
public async Task <IHttpActionResult> GetDobi(int skip = 0, int limit = 10) { if (skip < 0 || limit < 1) { return(BadRequest("Invalid pagination data.")); } var dobi = await _dobiRepository.GetDobi(skip, limit); var totalDobi = await _dobiRepository.GetDobiCount(); var response = new DobiListResponse { DobiList = dobi, TotalDobi = totalDobi }; return(Ok(new GenericResponse <DobiListResponse>(true, response))); }