Example #1
0
        // GET: Contact
        public ActionResult Index(MemberContext mem)
        {
            var unitOfWork = new GenericRepository.UnitOfWork(mem);

            List <File> fileList = unitOfWork.Repository <MemberDatabase.File>().Query().Get().ToList();

            return(View(fileList));
        }
Example #2
0
        // GET: Contact
        public ActionResult Index(MemberContext mem)
        {
            var unitOfWork = new GenericRepository.UnitOfWork(mem);

            List <Group> groupList = unitOfWork.Repository <Group>().Query().Get().ToList();

            int members = groupList[1].Members.Count();

            return(View(groupList));
        }
Example #3
0
        // GET: Document
        public ActionResult Index()
        {
            string        connection = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            MemberContext mem        = new MemberContext(connection);
            var           unitOfWork = new GenericRepository.UnitOfWork(mem);

            //            List<File> fileList = mem.myFiles.Where(f => f.FileType != "Photo").ToList();
            List <File> fileList = unitOfWork.Repository <File>().Query().Get().ToList();

            return(View("Documents", fileList));
        }
Example #4
0
        public ActionResult View(int Id, MemberContext mem)
        {
            var unitOfWork = new GenericRepository.UnitOfWork(mem);


            MemberDatabase.Contact contact1 = unitOfWork.Repository <Contact>().FindById(Id);



            return(View(contact1));
        }
Example #5
0
        public virtual ActionResult Delete(int id)
        {
            string        connection = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            MemberContext mem        = new MemberContext(connection);
            var           unitOfWork = new GenericRepository.UnitOfWork(mem);

            unitOfWork.Repository <File>().Delete(id);
            unitOfWork.Save();


            return(RedirectToAction("Index"));
        }
Example #6
0
        public ActionResult Add(MemberDatabase.Contact myContact, MemberContext mem)
        {
            //    string connection = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            //    MemberContext mem = new MemberContext(connection);
            var unitOfWork = new GenericRepository.UnitOfWork(mem);

            unitOfWork.Repository <Contact>().InsertGraph(myContact);

            unitOfWork.Save();
            List <Contact> memList = unitOfWork.Repository <Contact>().Query().Get().ToList();


            return(View("Index", memList));
        }
Example #7
0
        public ActionResult Add(MemberDatabase.Group myGroup)
        {
            string connection = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            MemberContext mem = new MemberContext(connection);

            var unitOfWork = new GenericRepository.UnitOfWork(mem);

            unitOfWork.Repository <MemberDatabase.Group>().Insert(myGroup);


            unitOfWork.Save();
            List <Group> groupList = unitOfWork.Repository <Group>().Query().Get().ToList();


            return(View("Index", groupList));
        }
Example #8
0
        // GET: Contact
        public ActionResult Member(MemberContext mem)
        {
            //ContactList objContacts = new ContactList();

            ////something feels redundant here
            //List<Models.Contact> _objContact = new List<Models.Contact>();
            //_objContact = null; //GetContactList();
            ////objContacts.ContactModel = _objContact;
            //string connection = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            //MemberContext mem = new MemberContext(connection);
            var unitOfWork = new GenericRepository.UnitOfWork(mem);

            List <Contact> contactList = unitOfWork.Repository <Contact>().Query().Get().ToList();

            return(View(contactList));
        }
Example #9
0
        public ActionResult UploadPhoto(HttpPostedFileBase file, MemberContext mem)
        {
            string serverPath = "";
            string filePath   = "";

            if (file != null && file.ContentLength > 0)
            {
                try
                {
                    //useful, but actually not used here. I eventually figured out changing permissions on the folder
                    //this returned mfreedm
                    string user = HttpContext.User.Identity.Name;

                    serverPath = "/Platform/Images/" + file.FileName;
                    filePath   = Server.MapPath(serverPath);
                    file.SaveAs(filePath);
                    ViewBag.Message = "File uploaded successfully";
                }
                catch (Exception ex)
                {
                    ViewBag.Message = "ERROR:" + ex.Message.ToString();
                }
            }
            else
            {
                ViewBag.Message = "You have not specified a file.";
            }

            var unitOfWork = new GenericRepository.UnitOfWork(mem);

            MemberDatabase.File photo = new MemberDatabase.File();

            photo.FilePath    = serverPath;
            photo.FileType    = "Photo";
            photo.UploadDate  = DateTime.Now;
            photo.Description = "uploaded document";

            unitOfWork.Repository <MemberDatabase.File>().Insert(photo);
            unitOfWork.Save();


            List <File> fileList = unitOfWork.Repository <MemberDatabase.File>().Query().Get().ToList();

            return(View("Index", fileList));
        }
Example #10
0
        public ActionResult Update(MemberDatabase.Contact myContact, MemberContext mem)
        {
            //string connection = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            //MemberContext mem = new MemberContext(connection);
            var unitOfWork = new GenericRepository.UnitOfWork(mem);

            unitOfWork.Repository <Contact>().Update(myContact);

            //  mem.Entry(myContact).Property(m => m.Username).IsModified = true;
            //mem.Entry(myContact).Property(m => m.FirstName).IsModified = true;
            //mem.Entry(myContact).Property(m => m.LastName).IsModified = true;
            //mem.Entry(myContact).Property(m => m.Email).IsModified = true;

            unitOfWork.Save();
            List <Contact> memList = unitOfWork.Repository <Contact>().Query().Get().ToList();


            return(View("Index", memList));
        }
Example #11
0
        public ActionResult UploadDocument(HttpPostedFileBase file)
        {
            string        connection = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            MemberContext mem        = new MemberContext(connection);
            var           unitOfWork = new GenericRepository.UnitOfWork(mem);

            if (file != null && file.ContentLength > 0)
            {
                string path = "C:\\Users\\mfreedm\\Documents\\Visual Studio 2015\\Projects\\Platform\\Platform\\Temp";
                try
                {
                    file.SaveAs(path);
                    ViewBag.Message = "File uploaded successfully";
                }
                catch (Exception ex)
                {
                    ViewBag.Message = "ERROR:" + ex.Message.ToString();
                }


                MemberDatabase.File newFile = new MemberDatabase.File();

                newFile.FilePath    = path;
                newFile.Description = "File Uploaded";

                unitOfWork.Repository <File>().Insert(newFile);
                unitOfWork.Save();
            }
            else
            {
                ViewBag.Message = "You have not specified a file.";
            }

            List <File> fileList = unitOfWork.Repository <File>().Query().Get().ToList();

            //problems with losing viewbag after using redirectToaction
            return(View("Documents", fileList));
        }