private category ParseModel(CategoryVM vm)
        {
            var model = new category();
            model.id = vm.Id;
            model.category_name = vm.Name;

            return model;
        }
        public IHttpActionResult PostProduct(CategoryVM category)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }
               categoryRepo.Add(category);

            return CreatedAtRoute("DefaultApi", new { id = category.Id }, category);
        }
        public IHttpActionResult Putcategory(int id, CategoryVM category)
        {
            if (!ModelState.IsValid) { return BadRequest(ModelState); }

            if (id != category.Id) { return BadRequest();  }

            try
            {
                categoryRepo.Update(category);

            }
            catch (DbUpdateConcurrencyException)
            {
                if (categoryRepo.GetCategory(id) == null){
                    return NotFound();
                }
                else {
                    throw;
                }
            }
            return StatusCode(HttpStatusCode.NoContent);
        }
 public void Update(CategoryVM _category)
 {
     dbContext.Entry(ParseModel(_category)).State = System.Data.Entity.EntityState.Modified;
     dbContext.SaveChanges();
 }
 public void Add(CategoryVM _category)
 {
     dbContext.categories.Add(ParseModel(_category));
     dbContext.SaveChanges();
 }