public ActionResult DeleteFile(string path, string id)
        {
            try
            {
                //Session["UserInfo"] = "1111";
                //var msgv = Session["UserInfo"].ToString();
                //string root = "/Images/" + msgv;
                var fullPath = Server.MapPath("~" + id);

                if (System.IO.File.Exists(fullPath))
                {
                    System.IO.File.Delete(fullPath);
                    var model = new PersonalExtratimeActive();
                    model.Pid   = Convert.ToInt64(id);
                    model.Proof = path;
                    var data = _pextaSrv.DeleteFile(model);


                    return(Json(new { returnData = data }));
                }
                else
                {
                    return(Json(new { returnData = false }));
                }
            }
            catch (Exception)
            {
                return(Json(new { returnData = false }));
            }
        }
        public ActionResult Update(string Id, string KindActive, string Date,
                                   string Hour, string Content,
                                   string Location)
        {
            try
            {
                var msgv = Session["UserInfo"].ToString();
                PersonalExtratimeActive data = new PersonalExtratimeActive();
                data.Pid         = Convert.ToInt64(Id);
                data.Date        = Convert.ToDateTime(Date);
                data.Time        = Hour;
                data.Content     = Content;
                data.Location    = Location;
                data.TeacherCode = msgv;
                data.KindActive  = Convert.ToInt64(KindActive);
                //string a = data["Date"].ToString();
                // _pextaSrv.Update(data);

                return(Json(new { returnData = _pextaSrv.Update(data), jsData = _pextaSrv.GetAllData() }));
            }
            catch (Exception)
            {
                return(Json(new { returnData = false }));
            }
        }
        public ActionResult SaveFile(string id)
        {
            try
            {
                var    msgv = Session["UserInfo"].ToString();
                string root = "/Images/" + msgv;
                foreach (string item in Request.Files)
                {
                    HttpPostedFileBase file = Request.Files[item] as HttpPostedFileBase;
                    //string fileName = file.FileName;
                    //string UploadPath = "~/Images/";
                    var fileName = Path.GetFileName(file.FileName);
                    var ext      = Path.GetExtension(file.FileName);

                    string myfile = DateTime.Now.Day.ToString() +
                                    DateTime.Now.Month.ToString() +
                                    DateTime.Now.Year.ToString() +
                                    DateTime.Now.Hour.ToString() +
                                    DateTime.Now.Minute.ToString() +
                                    DateTime.Now.Millisecond +
                                    "_" + msgv + ext;


                    var path = Path.Combine(Server.MapPath("~/Images/" + msgv), myfile);
                    file.SaveAs(path);
                    string url   = root + "/" + myfile + ";";
                    var    model = new PersonalExtratimeActive();
                    model.Pid   = Convert.ToInt64(id);
                    model.Proof = url;
                    var data = _pextaSrv.UpdateFile(model);
                }

                return(Json(new { returnData = true }));
            }
            catch (Exception)
            {
                return(Json(new { returnData = false }));
            }
        }
        public ActionResult Save(List <HttpPostedFileBase> upload,
                                 long KindActive, string Date,
                                 string Hour, string Content,
                                 string Location)
        {
            try
            {
                var    msgv     = Session["UserInfo"].ToString();
                string root     = "Images/" + msgv;
                var    filePath = Path.Combine(Server.MapPath("~/Images/" + msgv));
                // If directory does not exist, create it.
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }
                string url = string.Empty;
                if (upload != null)
                {
                    foreach (var item in upload)
                    {
                        var fileName = Path.GetFileName(item.FileName);
                        var ext      = Path.GetExtension(item.FileName);

                        //string name = Path.GetFileNameWithoutExtension(fileName);
                        string myfile = DateTime.Now.Day.ToString() +
                                        DateTime.Now.Month.ToString() +
                                        DateTime.Now.Year.ToString() +
                                        DateTime.Now.Hour.ToString() +
                                        DateTime.Now.Minute.ToString() +
                                        DateTime.Now.Millisecond +
                                        "_" + msgv + ext;


                        var path = Path.Combine(Server.MapPath("~/Images/" + msgv), myfile);
                        item.SaveAs(path);
                        url = url + root + "/" + myfile + ";";
                        //item.SaveAs(filePath);
                    }
                }



                PersonalExtratimeActive data = new PersonalExtratimeActive();
                data.Date        = Convert.ToDateTime(Date);
                data.Time        = Hour;
                data.Content     = Content;
                data.Location    = Location;
                data.TeacherCode = msgv;
                data.KindActive  = Convert.ToInt64(KindActive);
                data.Proof       = url;
                data.Status      = 0;
                //string a = data["Date"].ToString();
                _pextaSrv.Save(data);

                return(Json(new { returnData = true, jsData = _pextaSrv.GetAllData() }));
            }
            catch (Exception ex)
            {
                return(Json(new { returnData = false }));
            }
        }