Пример #1
0
        public VehicleHistoryItem GetById(int id)
        {
            Mapper.CreateMap <Vehicle_History, VehicleHistoryItem>();
            Vehicle_History    objVhtbl  = DbContext.Vehicle_History.SingleOrDefault(m => m.ID == id);
            VehicleHistoryItem objVHItem = Mapper.Map <VehicleHistoryItem>(objVhtbl);

            return(objVHItem);
        }
Пример #2
0
        public int Update(VehicleHistoryItem model)
        {
            Mapper.CreateMap <VehicleHistoryItem, Vehicle_History>();
            Vehicle_History objVH = DbContext.Vehicle_History.SingleOrDefault(m => m.ID == model.ID);

            objVH = Mapper.Map(model, objVH);
            return(DbContext.SaveChanges());
        }
Пример #3
0
 public int Insert(VehicleHistoryItem model)
 {
     try
     {
         Mapper.CreateMap <VehicleHistoryItem, Vehicle_History>();
         Vehicle_History objVehicle = Mapper.Map <Vehicle_History>(model);
         DbContext.Vehicle_History.Add(objVehicle);
         return(DbContext.SaveChanges());
     }
     catch (Exception ex)
     {
         throw;
     }
 }