public ProposalController(ILogger <ProposalController> logger, IProposalRepository proposalRepository, ProposalContext context) { _logger = logger; _context = context; _proposalRepository = proposalRepository; }
public ActionResult AddProposalContext(ProposalContext context, HttpPostedFileBase imagePath) { string filePath = ""; string guid = Guid.NewGuid().ToString() + "_" + Path.GetExtension(imagePath.FileName); filePath = Path.Combine(Server.MapPath("~/wwwroot/images/staticImages/bigImg/"), guid); imagePath.SaveAs(filePath); context.imagePath = "/wwwroot/images/staticImages/bigImg/" + guid; ctx.tbProposalContext.Add(context); ctx.SaveChanges(); return(RedirectToAction("Home", "Proposal")); }
public ActionResult EditProposalContext(int?id, ProposalContext context, HttpPostedFileBase imagePath) { var myProposalContext = ctx.tbProposalContext.Where(x => x.Id == id).FirstOrDefault(); myProposalContext.name = context.name; myProposalContext.description = context.description; if (imagePath != null) { string filePath = ""; string guid = Guid.NewGuid().ToString() + "_" + Path.GetExtension(imagePath.FileName); filePath = Path.Combine(Server.MapPath("~/wwwroot/images/staticImages/bigImg/"), guid); imagePath.SaveAs(filePath); context.imagePath = "/wwwroot/images/staticImages/bigImg/" + guid; } ctx.SaveChanges(); return(RedirectToAction("Home", "Proposal")); }
public ProposalRepository(ProposalContext context) : base(context) { }
public CommitProvider() { _context = ProposalContext.Default; }
public ProposalRepository(ProposalContext db) { this.db = ProposalContext.Default; }