public async Task <IActionResult> Create([Bind("tenancyId,propertyId,leadTenantPersonId,jointTenantPersonId,tenureTypeId,startDate,terminationDate,terminationReasonId,updatedByUserID,updatedDT,createdByUserID,createdDT")] TenancyViewModel tenancyVM)
        {
            if (ModelState.IsValid)
            {
                DateTime recordDT = DateTime.Now;
                var      tenancy  = _mapper.Map <tenancy>(tenancyVM);                  //Map viewmodel values to tenancy model object
                var      user     = await _userManager.GetUserAsync(HttpContext.User); //Get logged in user

                //Set created by & updated by values for record
                tenancy.createdByUserID = user.Id;
                tenancy.createdDT       = DateTime.Now;
                tenancy.updatedByUserID = user.Id;
                tenancy.updatedDT       = DateTime.Now;

                int newTenancyId = await _tenancySvc.AddTenancyAsync(tenancy);

                return(RedirectToAction(nameof(Details), new { @id = newTenancyId }));
            }

            ViewData["terminationReasonId"] = new SelectList(await _tenancySvc.GetTenancyterminationreasonsAsync(), "tenancyTerminationReasonId", "terminationReason", tenancyVM.terminationReasonId);
            ViewData["tenureTypeId"]        = new SelectList(await _tenancySvc.GetTenuretypesAsync(), "tenureTypeId", "tenureTypeId", tenancyVM.tenureTypeId);
            return(View(tenancyVM));
        }