Example #1
0
        public RedirectResult uploadFile(string tagList)
        {
            foreach (string inputTagName in Request.Files)
            {
                HttpPostedFileBase file = Request.Files[inputTagName];
                if (file.ContentLength > 0)
                {
                    string filePath = Server.MapPath("") + "\\" + file.FileName;
                    file.SaveAs(filePath);

                    Mash_v0._3.Models.File newFile = new Mash_v0._3.Models.File();

                    string email = ((FormsIdentity)System.Web.HttpContext.Current.User.Identity).Name.ToString();
                    User signedUser = db.Users.Where(user => user.email.Trim() == email).Single();

                    Project activeProject = Session["project"] as Project;

                    newFile.fileName = file.FileName;
                    newFile.idOwner = signedUser.idUser;
                    newFile.path = "Files\\" + file.FileName;
                    newFile.description = file.ContentType;
                    newFile.dateCreated = DateTime.Now;
                    newFile.dateUpdated = DateTime.Now;

                    db.Files.InsertOnSubmit(newFile);
                    db.SubmitChanges();

                    sif_ProjectFile newEntry = new sif_ProjectFile();
                    newEntry.idFile = newFile.idFile;
                    newEntry.idProject = activeProject.idProject;
                    db.sif_ProjectFiles.InsertOnSubmit(newEntry);
                    db.SubmitChanges();
                }
            }

            return Redirect("Files");
        }
Example #2
0
 partial void Deletesif_ProjectFile(sif_ProjectFile instance);
Example #3
0
 partial void Updatesif_ProjectFile(sif_ProjectFile instance);
Example #4
0
 partial void Insertsif_ProjectFile(sif_ProjectFile instance);
Example #5
0
		private void detach_sif_ProjectFiles(sif_ProjectFile entity)
		{
			this.SendPropertyChanging();
			entity.File = null;
		}
Example #6
0
		private void attach_sif_ProjectFiles(sif_ProjectFile entity)
		{
			this.SendPropertyChanging();
			entity.Project = this;
		}