Exemplo n.º 1
0
 public ActionResult Index()
 {
     // var repo = new UserRepository(db);
     var query = new QueryMasterData {Name = "gitau"};
     var result = _userRepository.Query(query);
     if(result.Count==0)
     {
         SafAppDbContextInitializer initializer = new SafAppDbContextInitializer();
         initializer.Seed();
     }
     return View();
 }
Exemplo n.º 2
0
        public TranferResponse<CategoryDTO> GetCategory(QueryMasterData query)
        {
            TranferResponse<CategoryDTO> response = new TranferResponse<CategoryDTO>();
               try
               {
               var data = _categoryRepository.Query(query);
               var result=data.Result.OfType<Category>().Select(Map).ToList();
               response.Data.AddRange(result);
               response.Status = true;
               response.RecordCount = data.Count;
               }
               catch (Exception ex)
               {
               response.Info = ex.Message;
               response.Status = false;

               }
               return response;
        }
Exemplo n.º 3
0
        public TranferResponse<UserDTO> GetAllUsers()
        {
            int take;
             int skip;
              var parameters = this.Request.RequestUri.ParseQueryString();
             string search = parameters["search"];
             PagingParam(out take,out skip);
             var query = new QueryMasterData();
             if(take!=0)
             {
                 query.Skip = skip;
                 query.Take = take;
             }
             if(!string.IsNullOrWhiteSpace(search))
             {
                 query.Name = search;
                 query.Description = search;
                 //query.Skip = 0;
             }

             var all = _dataTransferBuilder.GetAllUsers(query);
            return all;
        }