public VHelpArea SearchInfoByID(string id) { var res = new VHelpArea(); //查询条件 var predicate = WhereExtension.True <VHelpArea>();//初始化where表达式 if (!String.IsNullOrEmpty(id)) { predicate = predicate.And(p => p.ID.Contains(id)); } var result = DbSet.Where(predicate).ToList(); if (result.Count != 0) { res = result.First(); } else { res = null; } return(res); }
// 发布者 确认该志愿者为 认领人(其他人 状态为审核不通过) public BaseViewModel SetVHAStatus(string VID, string ContentID) { VHelpArea area = _IVHelpAreaRepository.SearchInfoByID(ContentID); BaseViewModel result = new BaseViewModel(); //确认 认领人员状态更新为 1(审核通过)、其他人员状态更新为 2(审核不通过);该互助信息 状态改为 1(已认领) List <VHA_Sign> list = _IVHA_SignRepository.GetByContentID(ContentID, "1"); foreach (var item in list) { //提示信息:您成功认领标题为XXX互助信息,请尽快处理 Volunteer_MessageMiddle middle = new Volunteer_MessageMiddle(); Volunteer_Info volunteer_Info = new Volunteer_Info(); if (item.CreateUser == VID) { volunteer_Info = _IVolunteerInfoRepository.SearchInfoByID(VID); //确认 认领人员状态更新为 1(审核通过) item.Status = "1"; middle.Contents = "您成功认领标题为 " + area.Title + " 互助信息,请尽快处理"; } else { volunteer_Info = _IVolunteerInfoRepository.SearchInfoByID(item.CreateUser); //其他人员状态更新为 2(审核不通过) item.Status = "2"; middle.Contents = "您认领标题为 " + area.Title + " 互助信息,认领不成功,已由其他志愿者处理"; } item.UpdateUser = item.CreateUser; item.UpdateDate = DateTime.Now; _IVHA_SignRepository.Update(item); int a = _IVHA_SignRepository.SaveChanges(); 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 = item.CreateUser; message.Status = "0"; _IVolunteer_MessageRepository.Add(message); int c = _IVolunteer_MessageRepository.SaveChanges(); } //该互助信息 状态改为 1(已认领) var modelVHA = _IVHelpAreaRepository.SearchInfoByID(ContentID); modelVHA.Status = "1"; modelVHA.UpdateUser = modelVHA.CreateUser; modelVHA.UpdateDate = DateTime.Now; _IVHelpAreaRepository.Update(modelVHA); int b = _IVHelpAreaRepository.SaveChanges(); if (b > 0) { result.ResponseCode = 200; result.Message = "操作成功"; } else { result.ResponseCode = 400; result.Message = "操作失败"; } return(result); }
public virtual void Update(VHelpArea obj) { DbSet.Update(obj); }
public virtual void Add(VHelpArea obj) { DbSet.Add(obj); }