Beispiel #1
0
        public async Task <bool> AddAsync(BO.ActiveAuctions obj)
        {
            try
            {
                await using (SqlConnection connection = await _context.GetConnection())
                {
                    await using (SqlCommand command = new SqlCommand("ActiveAuctionsAdd", connection)
                    {
                        CommandType = CommandType.StoredProcedure
                    })
                    {
                        command.Parameters.AddWithValue("@AuctionId", obj.AuctionId);
                        command.Parameters.AddWithValue("@Open", obj.Open);
                        command.Parameters.AddWithValue("@OpenedBy", obj.OpenedBy);
                        command.Parameters.AddWithValue("@ClosedBy", obj.ClosedBy);

                        return(await command.ExecuteNonQueryAsync() != -1);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
Beispiel #2
0
        public async Task <List <BO.ActiveAuctions> > ConvertToObj(SqlDataReader reader)
        {
            List <BO.ActiveAuctions> objects = new List <BO.ActiveAuctions>();

            while (await reader.ReadAsync())
            {
                BO.ActiveAuctions obj = new BO.ActiveAuctions
                {
                    AuctionId = int.Parse(reader["AuctionId"].ToString()),
                    Open      = bool.Parse(reader["Open"].ToString()),
                    OpenedBy  = int.Parse(reader["OpenedBy"].ToString()),
                    ClosedBy  = int.Parse(reader["ClosedBy"].ToString())
                };

                objects.Add(obj);
            }

            return(objects);
        }
 public async Task <bool> UpdateAsync(BO.ActiveAuctions obj)
 {
     return(await _dalActiveAuctions.UpdateAsync(obj));
 }
 public async Task <bool> AddAsync(BO.ActiveAuctions obj)
 {
     return(await _dalActiveAuctions.AddAsync(obj));
 }