public void CompleteEdit(Guid instanceId) { var editModel = _repository.Get(instanceId); editModel.Status = -1; var old_plans = _curingProcurementPlanRepository.GetAll().Where(r => r.MainId == editModel.MainId); foreach (var item in old_plans) { _curingProcurementPlanRepository.Delete(item); } var editPlans = _curingProcurementPlanRepository.GetAll().Where(r => r.MainId == editModel.Id); foreach (var item in editPlans) { var entity = new CuringProcurementPlan() { Id = Guid.NewGuid(), MainId = item.MainId, Name = item.Name, Version = item.Version, Number = item.Number, Unit = item.Unit, Money = item.Money, Des = item.Des, Type = item.Type, Remark = item.Remark, Status = item.Status, BusinessType = (int)CuringProcurementType.固化采购, }; _curingProcurementPlanRepository.Insert(entity); } }
/// <summary> /// 添加一个CuringProcurementPlan /// </summary> /// <param name="input">实体</param> /// <returns></returns> public async Task Create(CreateCuringProcurementPlanInput input) { var newmodel = new CuringProcurementPlan() { MainId = input.MainId, Name = input.Name, Version = input.Version, Number = input.Number, Unit = input.Unit, Money = input.Money, Des = input.Des, Type = input.Type, Remark = input.Remark, Status = input.Status, BusinessType = input.BusinessType, }; await _repository.InsertAsync(newmodel); }