private async Task <IHttpActionResult> Post(PlanNoChildrenDTO planDto) { using (var uow = ObjectFactory.GetInstance <IUnitOfWork>()) { if (!ModelState.IsValid) { return(BadRequest("Some of the request data is invalid")); } var curPlanDO = Mapper.Map <PlanNoChildrenDTO, PlanDO>(planDto, opts => opts.Items.Add("ptid", planDto.Id)); _plan.CreateOrUpdate(uow, curPlanDO); uow.SaveChanges(); var result = PlanMappingHelper.MapPlanToDto(_plan.GetFullPlan(uow, curPlanDO.Id)); return(Ok(result)); } }
public void CreateOrUpdate(IUnitOfWork uow, PlanDO submittedPlan) { _target.CreateOrUpdate(uow, submittedPlan); }