public ActionResult DeleteConfirmed(int id)
        {
            Danhmucdoan danhmucdoan = db.Danhmucdoans.Find(id);

            db.Danhmucdoans.Remove(danhmucdoan);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit([Bind(Include = "MaDM,TenDM,Hinhanhdm,MaCH")] Danhmucdoan danhmucdoans)
        {
            HttpResponseMessage response = client.PutAsJsonAsync(url + @"Danhmucdoans/" + danhmucdoans.MaDM, danhmucdoans).Result;

            response.EnsureSuccessStatusCode();
            SetAlert("Đã lưu chỉnh sửa!!!", "success");
            return(RedirectToAction("Index"));
        }
        // GET: Danhmucdoans/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            Danhmucdoan         danhmucdoans = null;
            HttpResponseMessage response     = await client.GetAsync(url + @"Danhmucdoans/" + id);

            if (response.IsSuccessStatusCode)
            {
                danhmucdoans = await response.Content.ReadAsAsync <Danhmucdoan>();
            }
            return(View(danhmucdoans));
        }
        public ActionResult Create(Danhmucdoan danhmucdoans)
        {
            HttpResponseMessage response = client.PostAsJsonAsync(url + @"Danhmucdoans/", danhmucdoans).Result;

            response.EnsureSuccessStatusCode();
            if (response.IsSuccessStatusCode)
            {
                SetAlert("Thêm danh mục thành công!!!", "success");
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Index"));
        }
        // GET: Danhmucdoans/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Danhmucdoan danhmucdoan = db.Danhmucdoans.Find(id);

            if (danhmucdoan == null)
            {
                return(HttpNotFound());
            }
            return(View(danhmucdoan));
        }
        // GET: Danhmucdoans/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            Danhmucdoan         danhmucdoans = null;
            HttpResponseMessage response     = await client.GetAsync(url + @"Danhmucdoans/" + id);

            if (response.IsSuccessStatusCode)
            {
                //dong hoac mo data table
                danhmucdoans = await response.Content.ReadAsAsync <Danhmucdoan>();

                ViewBag.accept = false;

                // Call api
                HttpResponseMessage responseMessage = await client.GetAsync(url + @"Doans/");

                List <Doan> doans = DoansController.getAllDoan(responseMessage);
                // Check data with id customer
                doans      = doans.Where(n => n.MaDM == id).ToList();
                ViewBag.da = doans;
            }
            return(View(danhmucdoans));
        }