Example #1
0
        public async Task <IActionResult> AdCreationAdInfo(ForetagDto foretagDto)
        {
            TempData["BadForetag"] = false;

            if (!ModelState.IsValid)
            {
                TempData["BadForetag"] = true;
                return(BadRequest("Unknown error"));
            }

            var newAd = new AdForetagDto()
            {
                foretagDto = foretagDto
            };

            newAd.Ad.PrisAnnons = 40.0f; /* Should not be controller's responsibility */
            try
            {
                TempData["BadForetag"] = false;
                return(View("AdCreationAdInfo", newAd));
            }
            catch
            {
                return(BadRequest("Unknown error"));
            }
        }
Example #2
0
        public async Task <IActionResult> AdCreationEditForetag()
        {
            if (!ModelState.IsValid)
            {
                return(ValidationProblem());
            }

            try
            {
                var foretag = new ForetagDto();
                return(View("AdCreationEditForetag", foretag));
            }
            catch
            {
                return(BadRequest("Unknown error"));
            }
        }