예제 #1
0
        public ActionResult Edit(int id, int?decissionId = null, Guid?userId = null, int?seminarId = null)
        {
            var firm = _firmRepository.GetNullableById(id);

            if (firm == null)
            {
                Message = string.Format(Messages.NotFound, "firm", id);
                return(this.RedirectToAction(a => a.Index()));
            }

            // if review, get the last one, if it exists
            var origFirm = firm.Review ? (_firmService.GetFirm(firm.FirmCode)) : firm;

            var viewModel = FirmViewModel.Create(Repository, firm, origFirm);

            ViewBag.DecissionId = decissionId;
            ViewBag.UserId      = userId;
            ViewBag.SeminarId   = seminarId;

            return(View(viewModel));
        }
예제 #2
0
        public static FirmViewModel ReadArchiveFirms()
        {
            var imported = Db.Trackings.Where(a => a.Name == _archiveFirmTable).Any();

            var firms  = new List <Firm>();
            var errors = new List <KeyValuePair <string, string> >();

            ReadData("~/Assets/Firm.xls", imported, firms, errors);

            if (!imported)
            {
                var tracking = new Tracking()
                {
                    Name = _archiveFirmTable
                };
                Db.Trackings.Add(tracking);
                Db.SaveChanges();
            }

            var viewModel = FirmViewModel.Create(firms, errors, imported);

            return(viewModel);
        }
예제 #3
0
        public ActionResult Edit(int id, Firm firm, int?decissionId = null)
        {
            ViewBag.DecissionId = decissionId;
            firm.Review         = false;

            if (ModelState.IsValid)
            {
                _firmRepository.EnsurePersistent(firm);
                Message = string.Format(Messages.Saved, "Firm");
                if (decissionId != null)
                {
                    return(this.RedirectToAction <SeminarApplicationController>(a => a.Decide(decissionId.Value)));
                }
                return(this.RedirectToAction(a => a.Index()));
            }

            // if review, get the last one, if it exists
            var origFirm = firm.Review ? (_firmService.GetFirm(firm.FirmCode)) : firm;

            var viewModel = FirmViewModel.Create(Repository, firm, origFirm);

            return(View(viewModel));
        }