Beispiel #1
0
        public bool Create(Models.Client.Car car)
        {
            if (car.OwnerId != null && car != null)
            {
                car.CreatedDate = DateTime.Now;
                car.Id          = Extensions.GenerateId();
                this._db.Cars.Add(this._mapper.Map <Models.Data.Car>(car));
                return(this._db.SaveChanges() > 0);
            }

            return(false);
        }
Beispiel #2
0
        public bool AddNewCar(Models.Client.Car car, string ownerId)
        {
            if (ownerId != null)
            {
                car.Id      = Guid.NewGuid().ToString();
                car.OwnerId = ownerId;
                this.Db.Cars.Add(Mapper.Map <Models.Client.Car, Models.Data.Car>(car));
                return(this.Db.SaveChanges() > 0);
            }

            return(false);
        }