I have a CRUD view developed in asp.net core.
I´ve got a very simple model
public class Categoria { [Required] public string id { get; set; } }
I´ve got this for delete in my controller:
[HttpPost, ActionName("Delete")] public bool Delete(string jsonData) { Categoria categoria = (Categoria)JsonConvert.DeserializeObject(jsonData, typeof(Categoria)); if (ModelState.IsValid) { _context.Categorias.Remove(categoria); _context.SaveChanges(); return true; } else { return false; } }
As
you can see i receive the parameters in the jsondata string. I expected to receive in my case a id string.
When i receive strings with no spaces it Works perfectly.
When i receive strings with spaces it Works when i work against a real sql-server, but it doesn´t Works when i work with a local sql express db.
For example if i try to delete this : "Hello Darling". In the jsondata string parameter i receive "HelloDarling" when i work against the local db instead of receiving the correct string "Hello Darling".
Tx in advanced.