public ActionResult MOCRecordEdit(MOCAPP.Models.MOC_Model.New_MOC_Model model)
        {
            int resultInvSave = -1;

            resultInvSave = objcom.UpdateMoc(model);


            if (resultInvSave == 1)
            {
                List <MOCAPP.Models.MOC_Model.New_MOC_Model> Moc_RecorList = objcom.Get_MocRecordEdit(model.MOC_Number);
                TempData["EditMoc"] = Moc_RecorList;

                TempData["Updatesucee"] = "Update Save SuccesFully..";
                return(RedirectToAction("MOCRecordEdit", "MOC"));
            }
            if (resultInvSave != 1)
            {
                List <MOCAPP.Models.MOC_Model.New_MOC_Model> Moc_RecorList = objcom.Get_MocRecordEdit(model.MOC_Number);
                TempData["EditMoc"]   = Moc_RecorList;
                TempData["UpdateErr"] = "Update Not , Please Try Again";
                return(RedirectToAction("MOCRecordEdit", "MOC"));
            }



            return(View());
        }
        public ActionResult NewMOC(MOCAPP.Models.MOC_Model.New_MOC_Model ListNew_Moc)

        {
            if (ModelState.IsValid)
            {
                string fileName = string.Empty;
                var    pic      = System.Web.HttpContext.Current.Request.Files["ImageData"];
                if (pic.ContentLength != 0)
                {
                    HttpPostedFileBase filebase = new HttpPostedFileWrapper(pic);
                    string             dirUrl   = "IMAGES";
                    //var fileName = Path.GetFileName(filebase.FileName);
                    fileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(pic.FileName);

                    string dirPath = Server.MapPath(dirUrl);
                    if (!Directory.Exists(dirPath))
                    {
                        Directory.CreateDirectory(dirPath);
                    }
                    string fileUrl = dirUrl + "/" + fileName;


                    var supportedTypes = new[] { "jpeg", "jpg", "png", "pdf" };


                    var fileExt = System.IO.Path.GetExtension(pic.FileName).Substring(1);


                    if (!supportedTypes.Contains(fileExt))
                    {
                        TempData["ImageErr"] = "File Extension Is InValid - Only Upload JPEG/JPG/PDF/PNG , Please Add Result Again";
                        return(RedirectToAction("NewMOC", "MOC"));
                    }

                    filebase.SaveAs(Server.MapPath(fileUrl));
                }

                int resultInvSave = -1;
                resultInvSave = objcom.SAVE_NEWMOC(ListNew_Moc, fileName);

                if (resultInvSave == 1)
                {
                    TempData["SaveSuccees"] = "Data Save SuccesFully..";
                    return(RedirectToAction("NewMOC", "MOC"));
                }
                if (resultInvSave != 1)
                {
                    TempData["SaveErr"] = "Data not Save , Please Try Again";
                    return(RedirectToAction("NewMOC", "MOC"));
                }



                return(RedirectToAction("NewMOC", "MOC"));
            }
            return(View());
        }
        public ActionResult MOCRecord(MOCAPP.Models.MOC_Model.New_MOC_Model obj)
        {
            List <MOCAPP.Models.MOC_Model.New_MOC_Model> Moc_RecorList = objcom.Get_MocRecordfilter(obj);

            if (Moc_RecorList.Count > 0)
            {
                TempData["MOCLIST"] = Moc_RecorList;
            }
            else
            {
                TempData["MOCLIST"] = null;
            }
            return(View());
        }