Exemplo n.º 1
0
        public async Task AddMessage(string description, string userId)
        {
            var message = new Message()
            {
                Description = description,
                UserId      = userId
            };

            db.Messages.Add(message);
            await db.SaveChangesAsync();
        }
Exemplo n.º 2
0
        public async Task Delete(int id)
        {
            if (await IsValidCar(id))
            {
                var car = await this
                          .db
                          .Cars
                          .SingleOrDefaultAsync(u => u.Id == id);

                this.db.Remove(car);
                await db.SaveChangesAsync();
            }
        }
Exemplo n.º 3
0
        public async Task AddPart(string name, decimal price, int quantity, int carId, string imageUrl)
        {
            var part = new Part()
            {
                Name     = name,
                Price    = price,
                Quantity = quantity,
                CarId    = carId,
                ImageUrl = imageUrl
            };

            db.Parts.Add(part);
            await db.SaveChangesAsync();
        }