Beispiel #1
0
 public Task SaveAsync(SearchCategorySelection categorySelection)
 {
     if (categorySelection.Id == Guid.Empty)
     {
         return(CreateAsync(categorySelection));
     }
     else
     {
         return(UpdateAsync(categorySelection));
     }
 }
Beispiel #2
0
        public Task UpdateAsync(SearchCategorySelection categorySelection)
        {
            if (categorySelection == null)
            {
                throw new ArgumentNullException("categorySelection");
            }

            return(Task.Factory.StartNew(() =>
            {
                using (IDbConnection connection = CurrentContext.OpenConnection())
                    connection.Execute("update app_SearchCategorySelections SET CakeId=@CakeId, CategoryOptionId=@CategoryOptionId where Id = @Id", categorySelection);
            }));
        }
Beispiel #3
0
        public Task CreateAsync(SearchCategorySelection categorySelection)
        {
            if (categorySelection == null)
            {
                throw new ArgumentNullException("categorySelection");
            }

            return(Task.Factory.StartNew(() =>
            {
                categorySelection.Id = Guid.NewGuid();
                using (IDbConnection connection = CurrentContext.OpenConnection())
                    connection.Execute("insert into app_SearchCategorySelections(Id, CakeId, CategoryOptionId) values(@Id, @CakeId, @CategoryOptionId)", categorySelection);
            }));
        }