public JsonResult Put(WX_Contacts _t)
 {
     IWXContactsService service = WMFactory.WXContacts;
     WX_Contacts entity = service.GetById(_t.Id.ToString());
     entity = AutoMapper<WX_Contacts, WX_Contacts>.Convert(_t, entity);
     if (service.Update(entity))
         return Json(ResultMsg.Success("更新成功!"));
     else
         return Json(ResultMsg.Failure("更新失败,请您重试!"));
 }
 public JsonResult DownloadContact(Guid sid)
 {
     IWXContactsService srv = new WXContactsService();
     Simulator smr = new Simulator();
     List<Contact> cntList = smr.GetWxContacts(sid);
     foreach (Contact cnt in cntList)
     {
         IEnumerable<WX_Contacts> temp = srv.FindByConditions(null, f => f.AccountId == sid && f.fake_id == cnt.id);
         if (temp != null && temp.Count() > 0)
         {
             //更新
             //WX_Contacts tempCnt = temp.FirstOrDefault();
             //tempCnt.nick_name = cnt.nick_name;
             //tempCnt.city = cnt.city;
             //tempCnt.province = cnt.province;
             //tempCnt.signature = cnt.signature;
             //tempCnt.country = cnt.country;
             //tempCnt.remark_name = cnt.remark_name;
             //srv.Update(tempCnt);
             continue;
         }
         //新增
         WX_Contacts tempNewCnt = new WX_Contacts();
         tempNewCnt.fake_id = cnt.id;
         tempNewCnt.nick_name = cnt.nick_name;
         tempNewCnt.city = cnt.city;
         tempNewCnt.province = cnt.province;
         tempNewCnt.signature = cnt.signature;
         tempNewCnt.country = cnt.country;
         tempNewCnt.remark_name = cnt.remark_name;
         tempNewCnt.AccountId = sid;
         tempNewCnt.groupName = cnt.group;
         srv.Insert(tempNewCnt);
     }
     return Json(ResultMsg.Success("微信账号同步已完成!共计:" + cntList.Count.ToString() + "条"));
 }
 public JsonResult Delete(WX_Contacts _t)
 {
     if (WMFactory.WXContacts.Delete(s => s.Id == _t.Id))
         return Json(ResultMsg.Success("删除成功!"));
     else
         return Json(ResultMsg.Failure("删除失败,请您重试!"));
 }