Пример #1
0
 public int AddFreeTrail(FreeTrailModel model)
 {
     try
     {
         Mapper.CreateMap<FreeTrailModel, FreeTrail>();
         var template = Mapper.Map<FreeTrailModel, FreeTrail>(model);
         int i = dbContext.SaveChanges();
         return i;
     }
     catch (Exception ex)
     {
         logger.Error("Method: AddFreeTrail()", ex);
         return 0;
     }
 }
Пример #2
0
 public int EditFreeTrail(FreeTrailModel model)
 {
     try
     {
         Mapper.CreateMap<FreeTrailModel, FreeTrail>();
         var template = Mapper.Map<FreeTrailModel, FreeTrail>(model);
         dbContext.Entry(template).State = EntityState.Modified;
         int i = dbContext.SaveChanges();
         return i;
     }
     catch (Exception ex)
     {
         logger.Error("Method: EditFreeTrail()", ex);
         return 0;
     }
 }