public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var sql = @" INSERT INTO [Candy] ([Name] ,[IsHard] ,[IsChocolate] ,[IsFruity] ,[Cost] ,[WillTrade]) OUTPUT inserted.* VALUES (@name ,'false' ,'true' ,'false' ,1 ,'true')"; return(db.Execute(sql, newCandy) == 1); } }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var sql = @"INSERT INTO [dbo].[Members] ( [username] ,[email] ,[status] ,[billingActive] ,[has2FA] ,[hasSSO] ,[userid] ,[fullname] ,[displayname]) output inserted.* VALUES ( @UserName ,@Email ,@Status ,@BillingActive ,@Has2FA ,@HasSSO ,@UserId ,@FullName ,@DisplayName)"; return(db.Execute(sql, newCandy) == 1); } //throw new NotImplementedException(); }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var sql = @"SELECT * FROM [Candy] WHERE ([Name] = @name AND [Size] = @size)"; var parameters = new { name = newCandy.Name, size = newCandy.Size }; var doubleCheck = db.Query <Candy>(sql, parameters).ToList(); if (doubleCheck.Count() == 0) { var sql2 = @" INSERT INTO [Candy] ([Name] ,[TypeId] ,[ImgUrl] ,[Size]) VALUES (@name ,@typeId ,@imgUrl ,@size)"; return(db.Execute(sql2, newCandy) == 1); } return(false); } }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var sql = @"INSERT INTO Candy ([Name] ,[Type] ,[Flavor] ,[Owner]) VALUES (@name, @type, @flavor, @owner)"; return(db.Execute(sql, newCandy) == 1); } }
public bool AddCandy(AddCandyDto newCandy) { string sql = "INSERT INTO [Candy] (Candy) Values (@newCandy);"; using (var db = new SqlConnection(_connectionString)) { var CandyAdded = db.Execute(sql, new { newCandy }); return(CandyAdded == 1); } }
public IActionResult Add(AddCandyDto newCandy) { if (_repo.AddCandy(newCandy)) { return(Created($"candy/{newCandy.Name}", newCandy)); } else { return(BadRequest()); } }
public IActionResult Add(AddCandyDto newCandy) { var candy = new Candy { Name = newCandy.Name, Texture = newCandy.Texture }; _repo.AddCandy(newCandy); return(Ok()); }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var sql = @" Insert into Candy ([Name],[candytypeId],[Candyflavor]) output inserted.* values (@name,@candytypeid,@candyflavor)"; return(db.Execute(sql, newCandy) == 1); } }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var sql = @" Insert into CandyMarket ([Name],Type,Flavor,isExpired) output inserted.* values (@name,@type,@flavor,@isExpired)"; return(db.Execute(sql, newCandy) == 1); } }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var cmd = @"INSERT INTO [Candy]([Name]) VALUES(@Name)"; return(db.Execute(cmd, newCandy) == 1); //return db.Execute(cmd, new { Name = newCandy.Name, Type = newCandy.Type}}) == 1; //@"INSERT INTO [Candy]([Name], [type]) // VALUES(@Name, @Type)"; } }
public IActionResult Add(AddCandyDto newAddCandyDto) { var newCandy = new Candy { CandyId = 1, Name = newAddCandyDto.Name, Category = newAddCandyDto.Category, YearsSinceCreation = newAddCandyDto.YearsSinceCreation }; var candyThatGotCreated = _repo.AddCandy(newCandy); return(Created($"api/candy/{candyThatGotCreated.Name}", candyThatGotCreated)); }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var sql = @"INSERT INTO [dbo].[Candy] ([Name] ,[CandyTypeId]) VALUES (@Name ,@CandyTypeId)"; return(db.Execute(sql, newCandy) == 1); } }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var sql = @"INSERT INTO [dbo].[Candy] ([Name] ,[Manufacturer] ,[Category]) VALUES (@name ,@manufacturer ,@category)"; return(db.Execute(sql, newCandy) == 1); } }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { throw new NotImplementedException(); //var sql = @"INSERT INTO [dbo].[Candy] // ([Name] // ,[Flavor] // ,[Price]) // output inserted.* // VALUES // (@name // ,@flavor // ,@price)"; //return db.QueryFirst<Candy>(sql, newCandy); } }
public Candy AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var sql = @"insert into [candy] ([name], [manufacturer], [category]) output inserted.* values (@name, @manufacturer, @category)"; var candy = db.QueryFirst <Candy>(sql, newCandy); return(candy); } }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var addCandy = @"insert into [Candy] ([Name]) output inserted.* values (@name)"; var parameters = new { name = newCandy.Name }; var rowsAffected = db.Execute(addCandy, parameters); return(rowsAffected == 1); } }
public bool AddCandy(AddCandyDto newCandy) { using var db = new SqlConnection(_connectionString); var sql = @"INSERT INTO [dbo].[Candy] ([Name] ,[Type] ,[TypeId] ,[Price] ,[UserId]) VALUES ( @name ,@type ,@typeId ,@price ,@UserId)"; return(db.Execute(sql, newCandy) == 1); }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var sql = @"INSERT INTO [Candy] ([Name] ,[Texture]) output inserted.* VALUES (@name ,@texture)"; //var parameters = new //{ // candyName = newCandy.Name, // candyType = newCandy.Type //}; return(db.Execute(sql, newCandy) == 1); } }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { var sql = @"INSERT INTO [Candy] ([Name] ,[YearsOfExperience] ,[Specialty]) output inserted.* VALUES (@name ,@yearsOfExperience ,@specialty)"; return(db.QueryFirst <Candy>(sql, newCandy)); //33:24 } }
public bool AddCandy(AddCandyDto newCandy) { using (var db = new SqlConnection(_connectionString)) { //check if candy exists //var candyCheck = @"SELECT * from Candy //WHERE [Name] = @name"; // if not, add to candy repo // then add to UserCandy var sqlQuery = @"Insert into [dbo].[Candy] ([Name] [Id) Values( @name @id)"; return(db.Execute(sqlQuery, newCandy) == 1); }; }
public bool AddCandy(AddCandyDto newCandy) { throw new NotImplementedException(); }
public Candy Add(AddCandyDto newCandy) { return(_repo.AddCandy(newCandy)); }
public void Add(AddCandyDto newCandy) { _repo.AddCandy(newCandy); }