Exemple #1
0
        public IActionResult DeleteFile([FromBody] ParentDTO parentr)
        {
            const string query = "DELETE FROM [dbo].[UserSaveFiles] WHERE [Id]={0}";
            var          rows  = _context.Database.ExecuteSqlCommand(query, parentr.idFile.Value);

            return(new HtmlResult("Its Ok!"));
        }
Exemple #2
0
 public IActionResult AddFileToUser([FromBody] ParentDTO parentr)
 {
     if (parentr != null)
     {
         UserSaveFile usf = new UserSaveFile()
         {
             UserId = parentr.idUser, SaveFileId = parentr.idFile.Value
         };
         _context.UserSaveFiles.Add(usf);
         _context.SaveChanges();
         return(Ok());
     }
     return(BadRequest());
 }