public async Task <IActionResult> Create([Bind("Document,DocumentTypeId,PropertyId,Expires,ActiveFrom,ExpiryDate")] PropertyDocumentCreateDto propertyDocument) { var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); if (ModelState.IsValid) { try { var property = await _context.Properties.Include(x => x.Portfolio).SingleOrDefaultAsync(x => x.Id == propertyDocument.PropertyId); var result = await _propertyDocumentService.CreatePropertyDocumentForProperty(propertyDocument); return(RedirectToAction("Detail", "Property", new { portfolioId = property.Portfolio.Id, propertyId = property.Id }).WithSuccess("Success", "Document Added")); } catch (ImageFormatLimitationException ex) { ModelState.AddModelError("Document", ex.Message); } } ViewData["DocumentTypeId"] = new SelectList(_context.DocumentTypes.Where(x => x.Owner == null || x.OwnerId == userId), "Id", "Description"); return(View(propertyDocument)); }