public async Task <ProductWriteModel> Create(ProductWriteModel product) { var user = await this.userRepository.GetByName(UserInfo.UserName); var company = companiesRepository.GetBydId(user.Id); productsRepository.Add(new Product { CompanyID = company.Id, Description = product.Description, Name = product.Name, Url = product.Url }); //TODO: get product with the ID and return it. return(product); }
public IActionResult Dashboard() { var user = userRepository.GetByName(UserInfo.UserName); var company = companiesRepository.GetBydId(user.Result.Id); var positionsBasicData = positionsManager.GetPositionsBasicData(company.Id); string companyPicture = null; if (company.Picture != null) { var imageBase64 = Convert.ToBase64String(company.Picture); companyPicture = string.Format("data:image/gif;base64,{0}", imageBase64); } return(View(new CompanyBasicDataReadModel { IdsNames = positionsBasicData, Picture = companyPicture })); }
public async Task <bool> ChangeDescription(ChangeCompanyDescriptionWrite changeComapnyDescription) { var user = await userRepository.GetByName(UserInfo.UserName); var company = companiesRepository.GetBydId(user.Id); try { company.CompanyDescription = changeComapnyDescription.CompanyDescription; companiesRepository.Save(); return(true); } catch (Exception ex) { throw; } }