Exemplo n.º 1
0
 public Task SaveAsync(SearchCategory category)
 {
     if (category.Id == Guid.Empty)
       {
     return CreateAsync(category);
       }
       else
       {
     return UpdateAsync(category);
       }
 }
Exemplo n.º 2
0
        public Task CreateAsync(SearchCategory category)
        {
            if (category == null)
            throw new ArgumentNullException("category");

              return Task.Factory.StartNew(() =>
              {
            category.Id = Guid.NewGuid();
            using (IDbConnection connection = CurrentContext.OpenConnection())
              connection.Execute("insert into app_SearchCategories(Id, Name) values(@Id, @Name)", category);
              });
        }
Exemplo n.º 3
0
        public Task UpdateAsync(SearchCategory category)
        {
            if (category == null)
            throw new ArgumentNullException("category");

              return Task.Factory.StartNew(() =>
              {
            using (IDbConnection connection = CurrentContext.OpenConnection())
              connection.Execute("update app_SearchCategories SET Name=@Name where Id = @Id", category);
              });
        }