public async Task <ActionResult> Store([FromBody] PlanViewModel model) { var plan = model.MapEntity(_mapper, CurrentUserId); plan.Discount = 50; //固定五折 await ValidateAsync(plan); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } plan = await _plansService.CreateAsync(plan); return(Ok(plan.Id)); }
public async Task <IActionResult> Post([FromForm] PlanDetail model) { var result = await _plans.CreateAsync(model); return(Ok(new ApiResponse <PlanDetail>(result, "Plan created successfully"))); }