public async Task<IHttpActionResult> Put([FromODataUri] string key, Category model)//[FromODataUri] string key,
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (key != model.Id)
            {
                return BadRequest();
            }

            var category = await db.Categories.FindAsync(model.Id);

            if (category == null)
            {
                return NotFound();
            }

            category.Modify(model, db);
            //db.Entry(category).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }

            return Updated(model);
        }
        public async Task<IHttpActionResult> Post(Category model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            try
            {

                model.Create(db);
                db.Categories.Add(model);

                await db.SaveChangesAsync();

                return Ok(model);
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("PostError", ex.Message);

                return BadRequest(ModelState);
            }
        }
 public void Modify(Category model, ApplicationDbContext db)
 {
     base.Modify(model,db);
 }