public ActionResult Edit(FileRegistration file)
        {
            int i=DAFileRegistration.UpdateFileById(file.FileId,file.Description);

            return RedirectToAction("Index");
        }
        public static FileRegistration GetFileRegistationById(int id)
        {
            FileRegistration file =  new FileRegistration();
            string sql = "SELECT * FROM FileRegistration WHERE FileId=@id";
            DbParameter par1 = Database.AddParameter(CONNECTIONSTRING, "@id", id);
            DbDataReader data = Database.GetData(CONNECTIONSTRING, sql, par1);

           
                data.Read();
                file.FileName = data["FileName"].ToString();
                file.Description = data["Description"].ToString();
                file.FileId = (int)data["FileId"];
                file.UploadTime =(DateTime) data["UploadTime"];
                file.UserName = data["UserName"].ToString();


            return file;
        }
        public ActionResult Delete(FileRegistration file)
        {
            int i = file.FileId;

            DAFileRegistration.DeleteFileById(i);
            return RedirectToAction("index");
        }
        public static FileRegistration LoadFileById(int id)
        {
            FileRegistration f = new FileRegistration();
            string sql = "SELECT a.FileId,a.Description,a.FileName,a.UploadTime,a.UserName FROM FileRegistration as a INNER JOIN FileUser as b ON a.FileId=b.FileId WHERE a.FileId=@id";
            DbParameter par1 = Database.AddParameter(CONNECTIONSTRING, "@id", id);
            DbDataReader data = Database.GetData(CONNECTIONSTRING, sql, par1);

            data.Read();

            f = Create(data);
            return f;
        }