public ActionResult Edit(JournalUpdateViewModel journal)
        {
            if (ModelState.IsValid)
            {
                var selectedJournal = Mapper.Map <JournalUpdateViewModel, Journal>(journal);
                JournalHelper.PopulateFile(journal.File, selectedJournal);

                var opStatus = _journalRepository.UpdateJournal(selectedJournal);
                if (!opStatus.Status)
                {
                    throw new System.Web.Http.HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
                }

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(journal));
            }
        }
        public ActionResult Create(JournalViewModel journal)
        {
            if (ModelState.IsValid)
            {
                var newJournal = Mapper.Map <JournalViewModel, Journal>(journal);
                JournalHelper.PopulateFile(journal.File, newJournal);

                newJournal.UserId = (int)_membershipService.GetUser().ProviderUserKey;

                var opStatus = _journalRepository.AddJournal(newJournal);
                if (!opStatus.Status)
                {
                    throw new System.Web.Http.HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
                }

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(journal));
            }
        }
        public ActionResult CreateIssue(JournalViewModel journal)
        {
            if (ModelState.IsValid)
            {
                var newJournal = Mapper.Map <JournalViewModel, Journal>(journal);
                //async use here
                JournalHelper.PopulateFile(journal.File, newJournal);

                newJournal.UserId = LoggedInUser.UserId;

                var opStatus = _journalRepository.AddJournalIssue(newJournal);
                if (!opStatus.Status)
                {
                    throw new System.Web.Http.HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
                }

                return(RedirectToAction("Issues", new { journalID = journal.JournalId }));
            }
            else
            {
                return(RedirectToAction("CreateIssue", new { journalID = journal.JournalId }));
            }
        }