public ActionResult CreatOrUpdateSelfRepairPlanByEngr(int appId, int selfRepairPlanId, string steps, string tools, double timecost, string isspare, string spareparts, string type) { bool result = false; SelfRepairPlanDto selfRepairPlanDto = new SelfRepairPlanDto(); selfRepairPlanDto.Step = steps; selfRepairPlanDto.Tool = tools; selfRepairPlanDto.TimeCost = timecost; selfRepairPlanDto.IsUseSpareParts = isspare; selfRepairPlanDto.SparePartsInfo = spareparts; var selfRepairPlan = Mapper.Map <SelfRepairPlanDto, SelfRepairPlan>(selfRepairPlanDto); int selfPlanId = 0; if (string.Equals(type, "Create")) { result = repairDAL.InsertNewSelfRepairPlan(selfRepairPlan, appId, out selfPlanId); } if (string.Equals(type, "modify")) { result = repairDAL.UpdateSelfRepairPlan(selfRepairPlan, selfRepairPlanId); } if (result) { return(Content(new { msg = "成功", status = "success", phase = CurrentStatus.自修方案待审.ToString(), methodCategory = MethodCategory.自修.ToString(), SelfRepairPlanID = selfPlanId }.ToJsonString())); } else { return(Content(new { msg = "失败", status = "failed" }.ToJsonString())); } }
public ActionResult GetSelfRepairPlanByAppId(int selfRepairPlanId) { SelfRepairPlan resultM = repairDAL.SelfRepairPlanByAppId(selfRepairPlanId); SelfRepairPlanDto resultDto = Mapper.Map <SelfRepairPlan, SelfRepairPlanDto>(resultM); if (resultDto != null) { return(Content(new { msg = "找到方案", status = "success", data = resultDto }.ToJsonString())); } else { return(Content(new { msg = "未找到方案", status = "failed" }.ToJsonString())); } }