public ActionResult Edit([Bind(Exclude = "Image")] LoginHeader loginHeader, HttpPostedFileBase Image)
        {
            if (ModelState.IsValid)
            {
                if (Image != null)
                {
                    if (Extensions.Extensions.CheckImageType(Image) && Extensions.Extensions.CheckImageSize(Image, 10))
                    {
                        loginHeader.Image = Extensions.Extensions.SaveImage(Server.MapPath("~/Public/images"), Image);


                        db.Entry(loginHeader).State = EntityState.Modified;
                        db.SaveChanges();

                        return(RedirectToAction("Index", "LoginHeader"));
                    }
                    else
                    {
                        ModelState.AddModelError("Image", "The type of image is incorrect or the size of image is greater than 10 Mb.");
                    }
                }
                else
                {
                    ModelState.AddModelError("Image", "Please choose an image");
                }
            }
            return(View());
        }
Beispiel #2
0
 public IActionResult GetUsers(LoginHeader header)
 {
     if (IsLoginValid(header))
     {
         return(Ok(UserRepository.GetUsers()));
     }
     return(BadRequest());
 }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound("ID is missing"));
            }

            LoginHeader loginHeader = db.LoginHeaders.Find(id);

            if (loginHeader == null)
            {
                return(HttpNotFound("ID was not found"));
            }

            return(View(loginHeader));
        }
Beispiel #4
0
 public IActionResult ValidateLogin(LoginHeader message)
 {
     try
     {
         if (UserRepository.IsLoginValid(message.Login, message.Password))
         {
             return(Ok(true));
         }
         else
         {
             return(Ok(false));
         }
     }
     catch
     {
         return(Forbid());
     }
 }
Beispiel #5
0
        public LoginAuthorizationPacket(PacketReader pr)
        {
            LoginHeader loginHeader = (LoginHeader)pr.ReadUInt16();

            switch (loginHeader)
            {
            case LoginHeader.Authorization:
            {
                //LoginScript.statusText.text = "Account accepted";
            }
            break;

            case LoginHeader.NonAuthorization:
            {
                //LoginScript.statusText.text = "Account not accepted";
            }
            break;
            }
        }
Beispiel #6
0
 public static NetworkPacket CreatePacket(this LoginHeader header)
 {
     return(new NetworkPacket((ushort)header));
 }