public async Task <ActionResult> Create([Bind(Include = "CategoryID,SubCategoryName,SubCategoryDesc,Sequence")] M_SubCategoryMaster m_SubCategoryMaster)
        {
            if (!CommonFunctionVD.CheckUserAuthentication())
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    m_SubCategoryMaster.CreatedBy    = Session["EmailID"].ToString();
                    m_SubCategoryMaster.CreatedDate  = DateTime.Now;
                    m_SubCategoryMaster.ModifiedBy   = Session["EmailID"].ToString();
                    m_SubCategoryMaster.ModifiedDate = DateTime.Now;
                    m_SubCategoryMaster.Active       = true;

                    db.M_SubCategoryMaster.Add(m_SubCategoryMaster);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }

                ViewBag.CategoryID = new SelectList(db.M_CategoryMaster, "CategoryID", "CategoryName", m_SubCategoryMaster.CategoryID);
                return(View(m_SubCategoryMaster));
            }
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            if (!CommonFunctionVD.CheckUserAuthentication())
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                M_SubCategoryMaster m_SubCategoryMaster = await db.M_SubCategoryMaster.FindAsync(id);

                db.M_SubCategoryMaster.Remove(m_SubCategoryMaster);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
        }
        // GET: SubCategoryMaster/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (!CommonFunctionVD.CheckUserAuthentication())
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                M_SubCategoryMaster m_SubCategoryMaster = await db.M_SubCategoryMaster.FindAsync(id);

                if (m_SubCategoryMaster == null)
                {
                    return(HttpNotFound());
                }
                return(View(m_SubCategoryMaster));
            }
        }
        // GET: SubCategoryMaster/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (!CommonFunctionVD.CheckUserAuthentication())
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                M_SubCategoryMaster m_SubCategoryMaster = await db.M_SubCategoryMaster.FindAsync(id);

                if (m_SubCategoryMaster == null)
                {
                    return(HttpNotFound());
                }
                ViewBag.CategoryID = new SelectList(db.M_CategoryMaster, "CategoryID", "CategoryName", m_SubCategoryMaster.CategoryID);
                return(View(m_SubCategoryMaster));
            }
        }