Beispiel #1
0
        public ActionResult Email(string number, VersionEmailViewModel model)
        {
            var company = new CompanyService(model.CompanyId).GetCompany();
            var version = company.FindVersion(number);

            if (version == null)
            {
                return(HttpNotFound());
            }
            model.Version = version;

            if (ModelState.IsValid)
            {
                try
                {
                    var appName = company.Application.AppName ?? company.CompanyName;
                    var subject = appName + " version " + version.Number;
                    var body    = this.RenderPartialViewToString("_Email", VersionViewModel.CreateFrom(company, version));
                    WebMail.Send(model.RecipientEmailAddress, subject, body);

                    return(RedirectToAction("Index", "Home"));
                }
                catch (Exception e)
                {
                    return(View(model));
                }
            }
            return(View(model));
        }
Beispiel #2
0
        //
        // GET: /Admin/Version/

        public ActionResult Index(string id)
        {
            var company = Repository.GetById(id);

            if (company == null)
            {
                return(HttpNotFound());
            }
            return
                (View(
                     company.Versions.Select(x => VersionViewModel.CreateFrom(company, x))
                     .OrderByDescending(x => x.CreatedOn)));
        }
Beispiel #3
0
        public ActionResult Detail(string compId, string id)
        {
            var company = new CompanyService(compId).GetCompany();
            var version = company.FindVersionById(id);

            if (version == null)
            {
                return(HttpNotFound());
            }
            var viewModel = VersionViewModel.CreateFrom(company, version);

            return(View(viewModel));
        }
Beispiel #4
0
        //
        // GET: /Admin/Version/Delete/5

        public ActionResult Delete(string id, string number)
        {
            var company = Repository.GetById(id);

            if (company == null)
            {
                return(HttpNotFound());
            }
            var version = company.FindVersion(number);

            if (version == null)
            {
                return(HttpNotFound());
            }
            return(View(VersionViewModel.CreateFrom(company, version)));
        }