Exemplo n.º 1
0
        public async Task IncreaseClickCount(int itemID)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@ItemID", itemID);
            await DapperORM.ExecuteWithoutReturnAsync("ItemClickCountSET", param);
        }
Exemplo n.º 2
0
        public async Task DeleteUser(int userID)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@UserID", userID);
            await DapperORM.ExecuteWithoutReturnAsync("UserDELETE", param);
        }
Exemplo n.º 3
0
        public async Task <IEnumerable <CascadingRegionNames> > GetCascadingRegionNames(int neighborhoodID)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@NeighborhoodID", neighborhoodID);
            return(await DapperORM.ReturListAsync <CascadingRegionNames>("RegionNamesGETByNeighborhoodID", param));
        }
Exemplo n.º 4
0
        public IEnumerable <RegionNeighborhoodModel> GetRegionNeighborhoods(int districtID)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@DistrictID", districtID);
            return(DapperORM.ReturList <RegionNeighborhoodModel>("RegionNeighborhoodGET", param));
        }
Exemplo n.º 5
0
        public IEnumerable <RegionDistrictModel> GetRegionDistricts(int countyID)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@CountyID", countyID);
            return(DapperORM.ReturList <RegionDistrictModel>("RegionDistrictGET", param));
        }
Exemplo n.º 6
0
        public IEnumerable <RegionCountyModel> GetRegionCounties(int cityID)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@CityID", cityID);
            return(DapperORM.ReturList <RegionCountyModel>("RegionCountyGET", param));
        }
Exemplo n.º 7
0
        public async Task <IEnumerable <PhoneModel> > GetPhonesByUserID(int userID)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@UserID", userID);
            return(await DapperORM.ReturListAsync <PhoneModel>("PhoneGET", param));
        }
Exemplo n.º 8
0
        public async Task ItemDelete(int itemID)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@ItemID", itemID);
            await DapperORM.ExecuteWithoutReturnAsync("ItemDELETE", param);
        }
Exemplo n.º 9
0
        public async Task <IEnumerable <CategoryModel> > GetCategories(int parentCategoryID = 0)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@ParentCategoryID", parentCategoryID);
            return(await DapperORM.ReturListAsync <CategoryModel>("CategoryGET", param));
        }
Exemplo n.º 10
0
        public async Task <IEnumerable <UserModel> > GetUsers(int userID = 0)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@UserID", userID);
            return(await DapperORM.ReturListAsync <UserModel>("UserGET", param));
        }
Exemplo n.º 11
0
        public async Task DeletePhone(int phoneID)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@PhoneID", phoneID);
            await DapperORM.ExecuteWithoutReturnAsync("PhoneDELETE", param);
        }
Exemplo n.º 12
0
        public async Task <IEnumerable <PropertyModel> > PropertyValueGet(int itemID)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@ItemID", itemID);
            return(await DapperORM.ReturListAsync <PropertyModel>("ItemPropertyValueGET", param));
        }
Exemplo n.º 13
0
        public async Task SaveItemPhoto(int itemID = 0, string fileName = "")
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@Path", fileName);
            param.Add("@ItemID", itemID);
            await DapperORM.ExecuteWithoutReturnAsync("ItemPhotoSET", param);
        }
Exemplo n.º 14
0
        public async Task MakeProfilePhoto(int itemID, string photoPath)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@ItemID", itemID);
            param.Add("@PhotoPath", photoPath);
            await DapperORM.ExecuteWithoutReturnAsync("ItemProfilePhotoSET", param);
        }
Exemplo n.º 15
0
        public async Task <IEnumerable <PropertyModel> > PropertyGet(int categoryID = 0, int propertyID = 0)
        {
            DynamicParameters param = new DynamicParameters();

            if (propertyID > 0)
            {
                param.Add("@PropertyID", propertyID);
            }
            param.Add("@CategoryID", categoryID);
            return(await DapperORM.ReturListAsync <PropertyModel>("PropertyGET", param));
        }
Exemplo n.º 16
0
        public async Task AddUser(UserRegisterModel user)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@Mail", user.Mail);
            param.Add("@Password", user.Password);
            param.Add("@Name", user.Name);
            param.Add("@Surname", user.Surname);
            param.Add("@Role", user.Role);
            param.Add("@TCKNO", user.Tckno);

            await DapperORM.ExecuteWithoutReturnAsync("UserSET", param);
        }
Exemplo n.º 17
0
        public LoginResultModel UserLogin(AuthenticateModel user)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@Mail", user.Mail);
            param.Add("@Password", user.Password);

            var result = DapperORM.ReturList <LoginResultModel>("UserLOGIN", param);

            if (result.Count <LoginResultModel>() == 0)
            {
                return(null);
            }
            return(result.First <LoginResultModel>());
        }
Exemplo n.º 18
0
        public async Task AddOrEdit(CategoryModel category)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@CategoryName", category.CategoryName);
            param.Add("@ParentCategoryID", category.ParentCategoryID);

            if (category.CategoryID == 0)
            {
                await DapperORM.ExecuteWithoutReturnAsync("CategorySET", param);
            }
            else
            {
                param.Add("@CategoryID", category.CategoryID);
                await DapperORM.ExecuteWithoutReturnAsync("CategoryUPDATE", param);
            }
        }
Exemplo n.º 19
0
        public async Task AddOrEditPhone(PhoneModel phoneModel)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@Number", phoneModel.Number);
            param.Add("@UserID", phoneModel.UserID);

            if (phoneModel.PhoneID == 0)
            {
                await DapperORM.ExecuteWithoutReturnAsync("PhoneSET", param);
            }
            else
            {
                param.Add("@PhoneID", phoneModel.PhoneID);
                await DapperORM.ExecuteWithoutReturnAsync("PhoneUPDATE", param);
            }
        }
Exemplo n.º 20
0
        public async Task AddOrEdit(PropertyModel property)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@PropertyName", property.PropertyName);
            param.Add("@Type", property.Type);
            param.Add("@CategoryID", property.CategoryID);

            if (property.PropertyID > 0)
            {
                param.Add("@PropertyID", property.PropertyID);
                await DapperORM.ExecuteWithoutReturnAsync("PropertyUPDATE", param);
            }
            else
            {
                await DapperORM.ExecuteWithoutReturnAsync("PropertySET", param);
            }
        }
Exemplo n.º 21
0
        public async Task <List <ItemModel> > GetItemWithPhotos(int itemID = 0, int userID = 0) //TO DO : make better
        {
            DynamicParameters param = new DynamicParameters();
            string            sql;

            if (userID > 0)
            {
                param.Add("@UserID", userID);
                sql = "ItemGETByUserID";
            }
            else
            {
                param.Add("@ItemID", itemID);
                sql = "ItemGET";
            }

            using (SqlConnection cnn = new SqlConnection(DapperORM.GetConnectionString()))
            {
                List <ItemModel> listItems = null;
                var lists = await cnn.QueryAsync <ItemModel, UserModel, ItemPhotoModel, ItemModel>(sql, (i, u, p) =>
                {
                    i.ItemPhotos = new List <ItemPhotoModel>();
                    i.ItemPhotos.Add(p);
                    i.User = new UserModel();
                    i.User = u;
                    return(i);
                }, param, commandType : CommandType.StoredProcedure, splitOn : "UserID, PhotoID");

                var result = lists.GroupBy(item => item.ItemID).Select(g =>
                {
                    var groupedPost        = g.First();
                    groupedPost.ItemPhotos = g.Select(p => p.ItemPhotos.Single()).ToList();
                    return(groupedPost);
                });
                listItems = result.ToList <ItemModel>();
                return(listItems);
            }
        }
Exemplo n.º 22
0
        public async Task AddOrEditItem(ItemModel item)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@Title", item.Title);
            param.Add("@Description", item.Description);
            param.Add("@CategoryID", item.CategoryID);
            param.Add("@UserID", item.User.UserID);
            param.Add("@Price", item.Price);
            param.Add("@State", item.State);
            param.Add("@NeighborhoodID", item.NeighborhoodID);
            param.Add("@MapX", item.MapX);
            param.Add("@MapY", item.MapY);
            param.Add("@ProfilePhotoPath", item.ProfilePhotoPath);

            if (item.ItemID == 0)
            {
                item.ItemID = DapperORM.ExecuteReturnScalar <int>("ItemSET", param);
                if (item.Properties != null)
                {
                    foreach (var property in item.Properties)
                    {
                        DynamicParameters propparam = new DynamicParameters();
                        propparam.Add("@PropertyID", property.PropertyID);
                        propparam.Add("@Value", property.Value);
                        propparam.Add("@ItemID", item.ItemID);
                        DapperORM.ExecuteWithoutReturn("ItemPropertyValueSET", propparam);
                    }
                }
            }
            else
            {
                param.Add("@ItemID", item.ItemID);
                await DapperORM.ExecuteWithoutReturnAsync("ItemUPDATE", param);
            }
        }
Exemplo n.º 23
0
 public IEnumerable <RegionCityModel> GetRegionCities()
 {
     return(DapperORM.ReturList <RegionCityModel>("RegionCityGET"));
 }