/// <summary> /// Save the data of the company asynchronously. /// </summary> /// <param name="companyData">Company data</param> /// <returns>Boolean company</returns> public async Task <bool> SaveAsync(ICompanyData companyData) { if (companyData.Value == null) { return(false); } return(await _saver.SaveAsync(companyData.Value).ConfigureAwait(false)); }
/// <summary> /// This delete the company asynchronously /// </summary> /// <param name="companyData">Data of the company</param> /// <returns>Return true of delete successfully</returns> public async Task <bool> DeleteCompanyAsyncDo(ICompanyData companyData) { if (companyData.Value == null) { return(false); } return(await _deleter.DeleteAsync(companyData.Value).ConfigureAwait(false)); }
public HomeController(ILogData logData, ITipsData tipsData, IArticlesData articlesData, ICompanyData companyData, IFeedData FeedData, IShingleData ShingleData) { _logData = logData; _tipsData = tipsData; _articlesData = articlesData; _companyData = companyData; _feedData = FeedData; _shingleData = ShingleData; }
protected override async Task <DataPayLoad> HandleSaveOrUpdate(DataPayLoad payLoad) { Contract.Requires(payLoad != null, "The payload at company data shall be not null"); Contract.Requires(payLoad.DataObject != null, "Payload shall have data object"); CompanyViewObject viewObject = payLoad.DataObject as CompanyViewObject; ICompanyData data = _companyDataServices.GetNewCompanyDo(viewObject.Code); data.Value = viewObject; bool result = await _companyDataServices.SaveAsync(data); // FIXME: where it is used current payload. shall enforce dry. if (result) { payLoad.Sender = ToolBarModule.NAME; payLoad.PayloadType = DataPayLoad.Type.UpdateView; CurrentPayload = new DataPayLoad(); CurrentPayload.PayloadType = DataPayLoad.Type.UpdateView; CurrentPayload.Sender = ToolBarModule.NAME; CurrentPayload.HasDataObject = true; CurrentPayload.Subsystem = payLoad.Subsystem; CurrentPayload.DataObject = data; } return(payLoad); }
public CompanyController(ICompanyData company) { _company = company; }
//lúc đầu là public ListtModel(IConfiguration config)... //x2 sau khi tạo ICompanyData thì thêm vào public ListtModel(IConfiguration config, ICompanyData companyData) //Báo lỗi, thì references với Data (hoặc Ctrl+. để biết lỗi và chọn references) //Báo lỗi, Ctrl. để tool đọc lỗi, sửa giúp // thêm Companies = companyData.GetAll(); vào OnGet(); để truyền dữ liệu vào GetAll(); public ListtModel(IConfiguration config, ICompanyData companyData) /*Ctrl.*/ { this.config = config; this.companyData = companyData; }
public CompanyController(ICompanyData companyData) { _companyData = companyData; }
//[BindProperty(SupportsGet = true)] //[BindProperty] public EditModel(ICompanyData companyData, IHtmlHelper htmlHelper) { this.companyData = companyData; this.htmlHelper = htmlHelper; }
public CompanyController() { data = new CompanyData(); }
public ListModel(IConfiguration config, ICompanyData companyData) { this.config = config; this.companyData = companyData; }
public DetailModel(ICompanyData companyData) { this.companyData = companyData; }
public DeleteModel(ICompanyData companyData) { this.companyData = companyData; //this.Companies = companyData.GetAll(); }
private static async Task SeedUsers(UserManager <User> userManager, ICompanyData companyData) { var companies = companyData.GetAll(null).ToArray(); var existingUser = await userManager.FindByNameAsync("Mili"); if (existingUser == null) { var user = new User { UserName = "******", CompanyId = companies[0].Id, Email = "*****@*****.**" }; var userCreateResult = await userManager.CreateAsync(user, Password); // TODO: log result if (userCreateResult.Succeeded) { user = await userManager.FindByNameAsync("Mili"); var roleAddResult = await userManager.AddToRoleAsync(user, AuthConstants.AdminRole); // TODO: log result var claimResult = await userManager.AddClaimsAsync(user, new List <Claim> { new Claim(AuthConstants.CompanyClaim, user.CompanyId.ToString()) }); // TODO: log result claimResult = await userManager.AddClaimsAsync(user, new List <Claim> { new Claim(AuthConstants.UserTypeClaim, AuthConstants.AdministratorClaimType) }); // TODO: log result } } existingUser = await userManager.FindByNameAsync("CRoberts"); if (existingUser == null) { var user = new User { UserName = "******", CompanyId = companies[1].Id, Email = "*****@*****.**" }; var userCreateResult = await userManager.CreateAsync(user, Password); // TODO: log result if (userCreateResult.Succeeded) { user = await userManager.FindByNameAsync("CRoberts"); var claimResult = await userManager.AddClaimsAsync(user, new List <Claim> { new Claim(AuthConstants.CompanyClaim, user.CompanyId.ToString()) }); // TODO: log result } } existingUser = await userManager.FindByNameAsync("Gigel"); if (existingUser == null) { var user = new User { UserName = "******", CompanyId = companies[0].Id, Email = "*****@*****.**" }; var userCreateResult = await userManager.CreateAsync(user, Password); // TODO: log result if (userCreateResult.Succeeded) { user = await userManager.FindByNameAsync("Gigel"); var claimResult = await userManager.AddClaimsAsync(user, new List <Claim> { new Claim(AuthConstants.CompanyClaim, user.CompanyId.ToString()) }); // TODO: log result } } }