예제 #1
0
        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);
            }
        }
예제 #2
0
        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)));
        }