//社区居民上传互助信息(名称、内容、所需擅长技能、姓名、联系方式、详细地址、可得积分) public BaseViewModel AddHelpArea(VHelpAreaSearchMiddle area) { BaseViewModel result = new BaseViewModel(); VHelpArea helpArea = _IMapper.Map <VHelpAreaSearchMiddle, VHelpArea>(area); helpArea.ID = Guid.NewGuid().ToString(); helpArea.CreateDate = DateTime.Now; helpArea.UpdateDate = DateTime.Now; helpArea.Status = "9"; _IVHelpAreaRepository.Add(helpArea); int a = _IVHelpAreaRepository.SaveChanges(); if (a > 0) { //提示信息:您已发布标题为XXX互助信息,等待审核 Volunteer_MessageMiddle middle = new Volunteer_MessageMiddle(); middle.Contents = "您已上传标题为 " + area.Title + " 互助信息,等待审核"; Volunteer_Info volunteer_Info = _IVolunteerInfoRepository.SearchInfoByID(area.CreateUser); middle.Name = volunteer_Info.Name; middle.VID = volunteer_Info.ID; middle.VNO = volunteer_Info.VNO; Volunteer_Message message = _IMapper.Map <Volunteer_MessageMiddle, Volunteer_Message>(middle); message.ID = Guid.NewGuid().ToString(); message.CreateDate = DateTime.Now; message.CreateUser = area.CreateUser; message.Status = "0"; _IVolunteer_MessageRepository.Add(message); int c = _IVolunteer_MessageRepository.SaveChanges(); result.ResponseCode = 200; result.Message = "上传成功,等待审核"; } else { result.ResponseCode = 400; result.Message = "上传失败,请重新操作"; } return(result); }
//志愿者互助信息退出功能 (互助ID标识ContentID、志愿者唯一VID、擅长技能TypeID为空不传参数) public string SetVHAStatusBack(string VID, string ContentID) { string result = String.Empty; result = _IVHA_SignRepository.SetStatusBack(VID, ContentID); if (result == "success") { VHelpArea res = new VHelpArea(); //更新 互助 表状态 可重新被认领 res = _IVHelpAreaRepository.SearchInfoByID(ContentID); if (res != null) { res.Status = "0"; _IVHelpAreaRepository.Update(res); int a = _IVHelpAreaRepository.SaveChanges(); } else { result = "fail"; } } return(result); }