Пример #1
0
        public ProposalController(ILogger <ProposalController> logger, IProposalRepository proposalRepository, ProposalContext context)
        {
            _logger = logger;

            _context = context;

            _proposalRepository = proposalRepository;
        }
Пример #2
0
        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"));
        }
Пример #3
0
        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"));
        }
Пример #4
0
 public ProposalRepository(ProposalContext context) : base(context)
 {
 }
Пример #5
0
 public CommitProvider()
 {
     _context = ProposalContext.Default;
 }
Пример #6
0
 public ProposalRepository(ProposalContext db)
 {
     this.db = ProposalContext.Default;
 }