public ActionResult Create(tbl_CompanyInfo tbl_companyinfo,HttpPostedFileBase file) { tbl_companyinfo.CreatedBy = User.Identity.Name; tbl_companyinfo.CreatedDate = DateTime.Now; tbl_companyinfo.ModifiedBy = User.Identity.Name; tbl_companyinfo.ModifiedDate = DateTime.Now; tbl_companyinfo.IsActive = true; tbl_companyinfo.ImagePath=""; if (ModelState.IsValid) { if (file != null) { file.SaveAs(HttpContext.Server.MapPath("~/Images/") + file.FileName); tbl_companyinfo.ImagePath = "Images/" + file.FileName; } db.tbl_CompanyInfo.AddObject(tbl_companyinfo); //Audit db.tbl_AuditTrail.AddObject(new tbl_AuditTrail { Action = "CREATE", ActionItem = "CompanyInfo", UserName = User.Identity.Name, ActionDate = DateTime.Now }); db.SaveChanges(); return RedirectToAction("Index"); } return View(tbl_companyinfo); }
/// <summary> /// Deprecated Method for adding a new object to the tbl_CompanyInfo EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTotbl_CompanyInfo(tbl_CompanyInfo tbl_CompanyInfo) { base.AddObject("tbl_CompanyInfo", tbl_CompanyInfo); }
/// <summary> /// Create a new tbl_CompanyInfo object. /// </summary> /// <param name="company_Id">Initial value of the Company_Id property.</param> /// <param name="companyName">Initial value of the CompanyName property.</param> /// <param name="text">Initial value of the Text property.</param> /// <param name="website">Initial value of the Website property.</param> /// <param name="createdBy">Initial value of the CreatedBy property.</param> /// <param name="createdDate">Initial value of the CreatedDate property.</param> /// <param name="modifiedBy">Initial value of the ModifiedBy property.</param> /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param> public static tbl_CompanyInfo Createtbl_CompanyInfo(global::System.Int32 company_Id, global::System.String companyName, global::System.String text, global::System.String website, global::System.String createdBy, global::System.DateTime createdDate, global::System.String modifiedBy, global::System.DateTime modifiedDate) { tbl_CompanyInfo tbl_CompanyInfo = new tbl_CompanyInfo(); tbl_CompanyInfo.Company_Id = company_Id; tbl_CompanyInfo.CompanyName = companyName; tbl_CompanyInfo.Text = text; tbl_CompanyInfo.Website = website; tbl_CompanyInfo.CreatedBy = createdBy; tbl_CompanyInfo.CreatedDate = createdDate; tbl_CompanyInfo.ModifiedBy = modifiedBy; tbl_CompanyInfo.ModifiedDate = modifiedDate; return tbl_CompanyInfo; }