コード例 #1
0
        public Insurance Create(Insurance insurance)
        {
            _carShopDbContext.Add(insurance);

            if (_carShopDbContext.SaveChanges() > 0)
            {
                return(insurance);
            }

            return(null);
        }
コード例 #2
0
        public void Add(AddCarFormViewModel car, string ownerId)
        {
            db.Add(new Car
            {
                Model       = car.Model,
                Year        = car.Year,
                PictureUrl  = car.Image,
                PlateNumber = car.PlateNumber,
                OwnerId     = ownerId,
            });

            db.SaveChanges();
        }