public async Task <ActionResult> Create(StoreModel StoreUserCreationData, FormCollection form, LoadCompanies LoadCompaniesService, CreateStore CreateStoreService) { ViewBag.CompaniesList = new SelectList(LoadCompaniesService.LoadMultiCompanies(), "Id", "Name"); ViewBag.error = ""; StoreUserCreationData.CompanyId = new Guid(form["CompanyID"]); // Reciving values from list try { if (StoreUserCreationData.CompanyId == null || StoreUserCreationData.CompanyId == Guid.Empty) { Console.Write(StoreUserCreationData.CompanyId); ViewBag.error = "Please select a company the store shoude belong to."; return(View()); } } catch (Exception e) { ViewBag.error = viebagMessage(e); } try { await CreateStoreService.createStore(StoreUserCreationData); return(RedirectToAction("Index")); } catch (Exception e) { ViewBag.error = viebagMessage(e); return(View()); } }