コード例 #1
0
        public ActionResult SendProposal(SubmitLogoViewModel submitLogoViewModel, HttpPostedFileBase file)
        {
            // to fix
            if (file == null)
            {
                return(PartialView("_Propose", submitLogoViewModel));
            }

            string fileName = submitLogoViewModel.Name + "-candidate.png";

            string path = System.IO.Path.Combine(
                Server.MapPath("~/Content/Domains/"), fileName);

            file.SaveAs(path);

            string logoPath = "~/Content/Domains/" + fileName;

            //var userId = User.Identity.GetUserId();
            var userId     = this.loggedInUser.GetUserId();
            var domainName = submitLogoViewModel.Name + ".com";

            this.domainService.UpdateDomainLogoPathAndDesignerId(domainName, logoPath, userId);
            TempData["Success"] = "Logo proposal for " + submitLogoViewModel.Name + " sent successfully!";
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public void ConstructorShouldCreate_SubmitLogoViewModel_WithoutParams()
        {
            // Act & Assert
            var submitLogoViewModel = new SubmitLogoViewModel();

            Assert.IsInstanceOf <SubmitLogoViewModel>(submitLogoViewModel);
        }
コード例 #3
0
        public ActionResult Propose(string name)
        {
            var submitLogoViewModel = new SubmitLogoViewModel()
            {
                Name = name
            };

            return(PartialView("_Propose", submitLogoViewModel));
        }
コード例 #4
0
        public void SubmitLogoViewModel_Should_Set_Properties_Correctly_With_CorrectData()
        {
            // Arrange
            var name = "name";
            var submitLogoViewModel = new SubmitLogoViewModel()
            {
                Name = name
            };

            // Act & Assert
            Assert.AreEqual(name, submitLogoViewModel.Name);
        }