0

I want to create a route attribute in the Porosi controller, in the detaje method that takes as a DatePorosie (DatePorosie is the date) on parameter. The method must display from Porosi.cs class EmriPorosise, DatePorosie, TotaliPorosise according to the date that comes as a parameter in url. (sending date value either by form or by link). I hope I explained it well. Can you help me please???

This is Porosi.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

    namespace MvcProjektDb.Models
    {
        public class Porosi
        {
            public int PorosiId { get; set; }

            public string EmriPorosise { get; set; }

            public DateTime DatePorosie { get; set; }

            public int TotaliPorosise { get; set; }

            public int? KlienteId { get; set; }

            public virtual Kliente Kliente { get; set; }
        }
    }

This is PorosiController.cs but I don't know what to do here

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcProjektDb.Migrations;
using MvcProjektDb.Models;

namespace MvcProjektDb.Controllers
{
    public class PorosiController : Controller
    {
        private ApplicationDbContext _db;

        public PorosiController()
        {
            _db = new ApplicationDbContext();
        }
        protected override void Dispose(bool disposing)
        {
            _db.Dispose();
        }
        // GET: Porosi
        public ActionResult Index()
        {
            return View();
        }

        [Route("Porosi/detaje/{dateporosie?}")]
        public ActionResult detaje(DateTime? dateporosie)
        {

            var x = _db.porosi.Where(p => p.DatePorosie == dateporosie).ToList();

            return View(x);
        }
    }
}
Emanuel
  • 13
  • 5

0 Answers0