public ActionResult Create(CertificateCreateModel model, HttpPostedFileBase file)
        {
            try
            {
                var certificate = new Certificate()
                {
                    Name = model.Name,
                    Description = model.Description,
                    Password = model.Password
                };

                if ((file == null) || string.IsNullOrEmpty(file.FileName))
                {
                    var msg = "A pfx certificate file must be specified";
                    ModelState.AddModelError("file", msg);
                    ViewBag.CertificateError = msg;

                    return View();
                }
                else if (!Path.GetExtension(file.FileName).Equals(".pfx", StringComparison.OrdinalIgnoreCase))
                {
                    var msg = "Only pfx certificates can be uploaded";
                    ModelState.AddModelError("file", msg);
                    ViewBag.CertificateError = msg;

                    return View();
                }

                if (file.ContentLength > 0)
                {
                    byte[] buffer = new byte[file.ContentLength];
                    file.InputStream.Read(buffer, 0, file.ContentLength);
                    certificate.Content = buffer;
                }

                this.certificateRepository.CreateCertificate(certificate);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
 public ActionResult Create()
 {
     var model = new CertificateCreateModel();
     return View(model);
 }