Ejemplo n.º 1
0
        public string LoginTry([FromBody] LoginMsg m)
        {
            if (!ModelState.IsValid)                                                       //Check if paremetars are valid
            {
                string odakle = Request.HttpContext.Connection.RemoteIpAddress.ToString(); //HttpContext.Connection.RemoteIpAddress
                Console.WriteLine($"Server primio los zahtev {odakle}");
                return("Primljen ne validan zahtev");
            }
            else
            {
                int whoID = 0;
                int who   = 0;

                int passed = eDnevnikDLL.VezaSaBazom.LoginKorisnika(m.Korisnik, m.LoginSifra, ref who, ref whoID);

                if (passed != 0)
                {
                    return("Neuspesan login");
                }

                LoginMsgOut lgmo      = new LoginMsgOut(who, whoID);
                var         uJsonu    = JsonSerializer.NonGeneric.Utf8.Serialize(lgmo);
                string      converted = System.Text.Encoding.UTF8.GetString(uJsonu, 0, uJsonu.Length);           //byte to string
                return(converted);
            }
        }
Ejemplo n.º 2
0
 [HttpPost] //AUtorize role ucenik
 public string PrikazUceniku([FromBody] LoginMsg m)
 {
     if (!ModelState.IsValid)//Check if paremetars are valid
     {
         Console.WriteLine("aaaaa");
         return("Pls send request in corect form :)");
     }
     else
     {
         return("aaa");
     }
 }