public IActionResult AddNewSubcollection(NewSubDTO newSubDto)
 {
     if (_repo.AddNewSubcollection(newSubDto))
     {
         return(Created($"collection/newsub/{newSubDto.SubCollectionName}", newSubDto));
     }
     else
     {
         return(BadRequest());
     }
 }
示例#2
0
 /// <summary>
 /// Creates a new empty subcollection
 /// </summary>
 /// <param name="newSubDTO">Object {Name: name of subcollection, UserId: unique user id}</param>
 /// <returns>True if no issues</returns>
 public bool AddNewSubcollection(NewSubDTO newSubDTO)
 {
     using (var db = new SqlConnection(_connectionString))
     {
         var sql = @"INSERT INTO [Collection]
                     ([Name],
                     [UserId])
                     VALUES
                     (
                      @SubCollectionName,
                      @UserId)";
         return(db.Execute(sql, newSubDTO) == 1);
     }
 }