public IEnumerable <TblUsers> Authentication([FromBody] dynamic id) { //ObservableCollection<Dictionary<string, object>> detailcollection = new ObservableCollection<Dictionary<string, object>>(); //Dictionary<string, object> InvoiceStatus = new Dictionary<string, object>(); //int UserId=0; IEnumerable <TblUsers> User = null; try { ObservableCollection <IDictionary <string, object> > obj = JsonConvert.DeserializeObject <ObservableCollection <IDictionary <string, object> > >(Convert.ToString(id)); string Status = string.Empty; foreach (Dictionary <string, object> header in obj) { //Status = header["Status"].ToString(); prxylogin = JsonConvert.DeserializeObject <ProxyLogin>(Convert.ToString(header["LogIn"].ToString())); //Invoicedetail = JsonConvert.DeserializeObject<List<ProxyInvoiceDetails>>(Convert.ToString(header["SalesDetail"].ToString())); } User = (from rec in _TripstarContext.TblUsers where rec.EmailId == prxylogin.UserName && rec.Password == prxylogin.Password select rec).ToList(); //return _repository.PostInvoice(Status, Headerdata, Invoicedetail); return(User); } catch (Exception ex) { //InvoiceStatus["Status"] = "Fail"; //InvoiceStatus["Error"] = "please check log file.."; //detailcollection.Add(InvoiceStatus); //File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "Log\\Errorlog.txt", ex.ToString()); return(User); } }
public async Task <string> LoginAsync(VmLogin para) { try { var proxyLogin = new ProxyLogin(); var tokenOffical = await proxyLogin.LoginAsync(para); if (tokenOffical == null || tokenOffical.Count <= 1) { return("登陆失败,请检查用户名或密码是否正确"); } BusinessCache.UserLogin.UserName = para.UserName; BusinessCache.UserLogin.Password = para.Password; BusinessCache.UserLogin.PasswordTran = para.PasswordTran; BusinessCache.UserLogin.TokenOffical = tokenOffical; await BusinessCache.UserAccounts.UpdateTokenOfficalAsync(para.UserName, tokenOffical); BusinessCache.UserProxies.UpdateFromUserAccount(BusinessCache.UserAccounts); return(string.Empty); } catch (Exception ex) { return(ex.ToString()); } }