public TransactionsViewModel() { using(var db = new ApplicationDbContext()) { Company = db.CompanyProfiles.First(); } }
public static string CompanyLogoPath(this HtmlHelper helper, CompanyProfile companyProfile) { return !string.IsNullOrEmpty(companyProfile.Logo) ? companyProfile.Logo : "~/Content/Images/default_company_logo.jpg"; }
private void SavePhoto(CompanyProfile companyProfile, HttpPostedFileBase logo) { if (logo != null && logo.ContentLength > 0) { var fileName = Path.GetFileName(logo.FileName); var logosFolder = "~/UploadedFiles/Company_Logos"; var path = Path.Combine(Server.MapPath(logosFolder), fileName); logo.SaveAs(path); companyProfile.Logo = logosFolder + "/" + fileName; } return; }