public async Task <ActionResult> Create(SubCategoryResource subCategoryresource) { if (ModelState.IsValid) { var subcategory = Mapper.Map <SubCategoryResource, SubCategory>(subCategoryresource); subcategory.CreatedDate = DateTime.Now; subcategory.UpdatedDate = DateTime.Now; var userId = System.Web.HttpContext.Current.User.Identity.GetUserId(); subcategory.UserId = userId; await _subcategoryService.AddAsync(subcategory); _subcategoryService.UnitOfWorkSaveChanges(); return(RedirectToAction("Index")); } var categorylist = _CategoryService.GetAllAsync(); ViewBag.CategoryId = new SelectList(categorylist.Result.Where(i => i.Status == true), "Id", "Name", subCategoryresource.CategoryID); return(View(subCategoryresource)); }