public ActionResult Edit(int id)
        {
            BusinessTypeVM obj = new BusinessTypeVM();

            ViewBag.statustype = db.tblStatusTypes.ToList();

            var c = (from d in db.BusinessTypes where d.Id == id select d).FirstOrDefault();

            if (c == null)
            {
                return(HttpNotFound());
            }
            else
            {
                obj.BusinessType = c.BusinessType1;
                obj.AcHeadId     = Convert.ToInt32(c.AcheadID);
                if (c.AcheadID != null)
                {
                    var achead = db.AcHeads.Find(c.AcheadID);
                    if (achead != null)
                    {
                        obj.AcHeadName = achead.AcHead1;
                    }
                }
            }

            return(View(obj));
        }
        public ActionResult Create(BusinessTypeVM c)
        {
            if (ModelState.IsValid)
            {
                BusinessType obj = new BusinessType();
                obj.BusinessType1 = c.BusinessType;
                obj.AcheadID      = c.AcHeadId;

                db.BusinessTypes.Add(obj);

                db.SaveChanges();
                TempData["SuccessMsg"] = "You have successfully added Business Type.";
                return(RedirectToAction("Index"));
            }

            return(View());
        }
        public ActionResult Edit(BusinessTypeVM c)
        {
            BusinessType obj = new BusinessType();

            obj.Id            = c.Id;
            obj.BusinessType1 = c.BusinessType;
            obj.AcheadID      = c.AcHeadId;

            if (ModelState.IsValid)
            {
                db.Entry(obj).State = EntityState.Modified;
                db.SaveChanges();
                TempData["SuccessMsg"] = "You have successfully Updated Business Type.";
                return(RedirectToAction("Index"));
            }
            return(View());
        }