public async Task <ActionResult> Create(CreateDictionaryViewModel model) { var resultWithData = _languageService.GetAll(); if (!resultWithData.Success) { // TODO } var languages = resultWithData.ResultData; ViewBag.SourceLanguageId = ViewBag.TargetLanguageId = new SelectList(languages, "Id", "Name"); if (!ModelState.IsValid) { ViewBag.Result = "Error"; return(PartialView("_Create", model)); } dynamic dictionary = new ExpandoObject(); dictionary.Name = model.Name; dictionary.Description = model.Description; dictionary.ApplicationUserId = User.Identity.GetUserId(); dictionary.SourceLanguageId = model.SourceLanguageId; dictionary.TargetLanguageId = model.TargetLanguageId; var result = await _dictionaryService.CreateAsync(dictionary); if (!result.Success) { ViewBag.Result = "Error"; return(PartialView("_Create", model)); } ViewBag.Result = "Success"; return(PartialView("_Create")); }