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));
            }
        }
예제 #2
0
        public async Task <ActionResult> Create([Bind(Include = "MasterValue,MasterTable,Sequence")] M_Master m_Master)
        {
            if (!CommonFunctionVD.CheckUserAuthentication())
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    m_Master.CreatedBy    = Session["EmailID"].ToString();
                    m_Master.CreatedDate  = DateTime.Now;
                    m_Master.ModifiedBy   = Session["EmailID"].ToString();
                    m_Master.ModifiedDate = DateTime.Now;
                    m_Master.Active       = true;

                    db.M_Master.Add(m_Master);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }

                return(View(m_Master));
            }
        }
예제 #3
0
        public async Task <ActionResult> Create([Bind(Include = "TitleNews,FileName,Remarks,Location,NoOfViews")] T_E_NewsPaper t_E_NewsPaper)
        {
            if (ModelState.IsValid)
            {
                string FullPathWithFileName1 = null;
                string FolderPathForImage1   = null;
                string FolderPath            = Server.MapPath(Resources.VDResources.eNewsPathShow) + "\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek;

                if (!string.IsNullOrEmpty(Request.Files["FileName"].FileName))
                {
                    FullPathWithFileName1 = FolderPath + "\\" + Request.Files["FileName"].FileName;
                    FolderPathForImage1   = "\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek + "\\" + Request.Files["FileName"].FileName;
                }
                if (CommonFunctionVD.IsFolderExist(FolderPath))
                {
                    if (!string.IsNullOrEmpty(Request.Files["FileName"].FileName))
                    {
                        Request.Files["FileName"].SaveAs(FullPathWithFileName1);
                        t_E_NewsPaper.FileName = FolderPathForImage1;
                    }
                }
                t_E_NewsPaper.CreatedBy    = Session["EmailID"].ToString();
                t_E_NewsPaper.CreatedDate  = DateTime.Now;
                t_E_NewsPaper.ModifiedBy   = Session["EmailID"].ToString();
                t_E_NewsPaper.ModifiedDate = DateTime.Now;
                t_E_NewsPaper.Active       = true;
                db.T_E_NewsPaper.Add(t_E_NewsPaper);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(t_E_NewsPaper));
        }
예제 #4
0
 // GET: AdminCtrl
 public ActionResult Index()
 {
     if (!CommonFunctionVD.CheckUserAuthentication())
     {
         return(RedirectToAction("Login", "Home"));
     }
     else
     {
         return(View());
     }
 }
예제 #5
0
 // GET: Master
 public async Task <ActionResult> Index()
 {
     if (!CommonFunctionVD.CheckUserAuthentication())
     {
         return(RedirectToAction("Login", "Home"));
     }
     else
     {
         return(View(await db.M_Master.ToListAsync()));
     }
 }
 // GET: NewsMasters
 public async Task <ActionResult> Index()
 {
     if (!CommonFunctionVD.CheckUserAuthentication())
     {
         return(RedirectToAction("Login", "Home"));
     }
     else
     {
         var t_NewsMasters = db.T_NewsMasters.Include(t => t.M_SubCategoryMaster).Include(t => t.M_Master);
         return(View(await t_NewsMasters.ToListAsync()));
     }
 }
 // GET: SubCategoryMaster/Create
 public ActionResult Create()
 {
     if (!CommonFunctionVD.CheckUserAuthentication())
     {
         return(RedirectToAction("Login", "Home"));
     }
     else
     {
         ViewBag.CategoryID = new SelectList(db.M_CategoryMaster, "CategoryID", "CategoryName");
         return(View());
     }
 }
 // GET: SubCategoryMaster
 public async Task <ActionResult> Index()
 {
     if (!CommonFunctionVD.CheckUserAuthentication())
     {
         return(RedirectToAction("Login", "Home"));
     }
     else
     {
         var m_SubCategoryMaster = db.M_SubCategoryMaster.Include(m => m.M_CategoryMaster);
         return(View(await m_SubCategoryMaster.ToListAsync()));
     }
 }
        public async Task <ActionResult> Create([Bind(Include = "NewsSubCategoryID,Heading,SubHeading,BodyMessage,VideoLink,Remarks,Location,NoOfViews,NewsType")] T_NewsMasters t_NewsMasters)
        {
            if (!CommonFunctionVD.CheckUserAuthentication())
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    string FullPathWithFileName1 = null;
                    string FolderPathForImage1   = null;
                    string FolderPath            = Server.MapPath(Resources.VDResources.NewsImagePath);

                    if (!string.IsNullOrEmpty(Request.Files["ImagesUpload"].FileName))
                    {
                        for (int i = 0; i < Request.Files.Count; i++)
                        {
                            Request.Files[i].SaveAs(FolderPath);
                        }

                        //FullPathWithFileName1 = FolderPath + "\\" + Request.Files["ImagesUpload"].FileName;
                        //FolderPathForImage1 = "\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek + "\\" + Request.Files["ImagesUpload"].FileName;
                    }
                    //if (CommonFunctionVD.IsFolderExist(FolderPath))
                    //{
                    //    if (!string.IsNullOrEmpty(Request.Files["ImagesUpload"].FileName))
                    //    {
                    //        Request.Files["ImagesUpload"].SaveAs(FullPathWithFileName1);
                    //    }
                    //}

                    t_NewsMasters.CreatedBy    = Session["EmailID"].ToString();
                    t_NewsMasters.CreatedDate  = DateTime.Now;
                    t_NewsMasters.ModifiedBy   = Session["EmailID"].ToString();
                    t_NewsMasters.ModifiedDate = DateTime.Now;
                    t_NewsMasters.Active       = true;
                    db.T_NewsMasters.Add(t_NewsMasters);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }

                ViewBag.NewsSubCategoryID = new SelectList(db.M_SubCategoryMaster, "SubCategoryID", "SubCategoryName", t_NewsMasters.NewsSubCategoryID);
                ViewBag.NewsType          = new SelectList(db.M_Master, "MasterID", "MasterValue", t_NewsMasters.NewsType);
                return(View(t_NewsMasters));
            }
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            if (!CommonFunctionVD.CheckUserAuthentication())
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                T_NewsMasters t_NewsMasters = await db.T_NewsMasters.FindAsync(id);

                db.T_NewsMasters.Remove(t_NewsMasters);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
        }
        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"));
            }
        }
        public async Task <ActionResult> Edit([Bind(Include = "CategoryID,CategoryName,CategoryDesc,Sequence,CreatedBy,CreatedDate,Active")] M_CategoryMaster m_CategoryMaster)
        {
            if (!CommonFunctionVD.CheckUserAuthentication())
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    m_CategoryMaster.ModifiedBy   = Session["EmailID"].ToString();
                    m_CategoryMaster.ModifiedDate = DateTime.Now;

                    db.Entry(m_CategoryMaster).State = EntityState.Modified;
                    await db.SaveChangesAsync();

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

                if (t_NewsMasters == null)
                {
                    return(HttpNotFound());
                }
                return(View(t_NewsMasters));
            }
        }
        // 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));
            }
        }
        public async Task <ActionResult> Edit([Bind(Include = "NewsID,NewsSubCategoryID,Heading,SubHeading,BodyMessage,VideoLink,Remarks,Location,NoOfViews,CreatedBy,CreatedDate,Active,NewsType")] T_NewsMasters t_NewsMasters)
        {
            if (!CommonFunctionVD.CheckUserAuthentication())
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    t_NewsMasters.ModifiedBy      = Session["EmailID"].ToString();
                    t_NewsMasters.ModifiedDate    = DateTime.Now;
                    db.Entry(t_NewsMasters).State = EntityState.Modified;
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
                ViewBag.NewsSubCategoryID = new SelectList(db.M_SubCategoryMaster, "SubCategoryID", "SubCategoryName", t_NewsMasters.NewsSubCategoryID);
                ViewBag.NewsType          = new SelectList(db.M_Master, "MasterID", "MasterValue", t_NewsMasters.NewsType);
                return(View(t_NewsMasters));
            }
        }
        // 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));
            }
        }
        // GET: NewsMasters/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));
                }
                T_NewsMasters t_NewsMasters = await db.T_NewsMasters.FindAsync(id);

                if (t_NewsMasters == null)
                {
                    return(HttpNotFound());
                }
                ViewBag.NewsSubCategoryID = new SelectList(db.M_SubCategoryMaster, "SubCategoryID", "SubCategoryName", t_NewsMasters.NewsSubCategoryID);
                ViewBag.NewsType          = new SelectList(db.M_Master, "MasterID", "MasterValue", t_NewsMasters.NewsType);
                return(View(t_NewsMasters));
            }
        }
        // GET: NewsMasters/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));
                }
                T_NewsMasters t_NewsMasters = await db.T_NewsMasters.FindAsync(id);

                string Bodymsg = t_NewsMasters.BodyMessage.Replace("[img]http://vaishalidairy.co.in/NewsPaperPics/", "<img src='http://vaishalidairy.co.in/NewsPaperPics/");
                Bodymsg += Bodymsg.Replace("[/img]", "' /> ");
                t_NewsMasters.BodyMessage = Bodymsg;
                if (t_NewsMasters == null)
                {
                    return(HttpNotFound());
                }
                return(View(t_NewsMasters));
            }
        }