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; } }
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; } }