示例#1
0
        }//LoginSubmit

        public async Task <IActionResult> NewUser([Bind("Email,Username,Password")] UserLogin Register)
        {
            if (ModelState.IsValid)
            {
                _context.Add(Register);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Login", "Users"));
            }

            return(View());
        }//NewUser
示例#2
0
        }//DuplicateCheck (Check against user input)
       

        public JsonResult AddFiles(string FileName, string Desc) 
        {
            AudioFiles AudioFile = new AudioFiles()
            {
                File = FileName,
                Description = Desc
            };

            bool Exists = AlreadyExists(null, AudioFile.File);
            if(!Exists)
            {
                _context.Add(AudioFile);
                _context.SaveChanges();

                return Json("Added");
            }
            else if(Exists)
            {
                return Json("Duplicate");
            }

            return Json("Failed");
        }//AddFiles (Create)