public async ValueTask AddTouristRouteAsync(TouristRoute route) { if (route == null) { throw new ArgumentNullException(nameof(route)); } await _context.TouristRoutes.AddAsync(route); }
public void AddTouristRoute(TouristRoute touristRoute) { if (touristRoute == null) { throw new ArgumentNullException(nameof(touristRoute)); } _context.TouristRoutes.Add(touristRoute); }
public void AddTouristRoute(TouristRoute touristRoute) { if (touristRoute == null) { throw new ArgumentException(nameof(touristRoute)); } _context.TouristRoutes.Add(touristRoute); //_context.SaveChanges(); }
// 1.判断数据是否合法 // 2.将新数据保存在上下文关系对象中 // 3.把数据写入数据库 public void AddTouristRoute(TouristRoute touristRoute) { // 1.判断数据是否合法 if (touristRoute == null) { throw new ArgumentNullException(nameof(touristRoute)); } // 2.将新数据保存在上下文关系对象中 _context.TouristRoutes.Add(touristRoute); }
public async Task <IActionResult> DeleteTouristRoute([FromRoute] Guid touristRouteId) { if (!(await _touristRouteRepository.TouristRouteExistAsync(touristRouteId))) { return(NotFound("旅游路线找不到")); } TouristRoute touristRoute = await _touristRouteRepository.GetTouristRouteAsync(touristRouteId); _touristRouteRepository.DeleteTouristRoute(touristRoute); await _touristRouteRepository.SaveAsync(); return(NoContent()); }
/// <summary> /// 添加旅游线路信息 /// </summary> /// <param name="input"></param> public void Add(AddOrEditTouristRouteInput input) { var route = new TouristRoute { NeedDays = input.NeedDays, RouteName = input.RouteName, ImgUrl = HttpPathCombine(_imgPath, input.ImgUrl) }; using (var db = new RTDbContext()) { db.TouristRoutes.Add(route); db.SaveChanges(); _detail.AddOrEdit(new AddOrEditDetailInput { ProjectId = route.Id, ImgUrl = HttpPathCombine(_imgPath, input.ImgUrl), Paragraphs = input.Contents }, db); db.SaveChanges(); } }
public void DeleteTouristRoute(TouristRoute touristRoute) { _context.TouristRoutes.Remove(touristRoute); }
public void AddTouristRoute(TouristRoute touristRoute) { throw new NotImplementedException(); }
public void UpdateTouristRoute(TouristRoute route) { // no code in this implementation }