Exemplo n.º 1
0
        public ActionResult ReceiveSample(VisitDetailsModel fact, string id)
        {
            var yesterday = DateTime.Now;
            var factname  = id;
            var report    = db.ConcreteSample1.Where(s => s.FactoryName == factname && DbFunctions.DiffDays(s.ReportDate, yesterday) == 1).FirstOrDefault();

            report.IsReceived = true;
            try
            {
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                return(RedirectToAction("ReceiveSample"));
            }

            var userId = Convert.ToInt32(Session["UserId"].ToString());

            VisitDetailsModel model        = new VisitDetailsModel();
            VisitService      visitService = new VisitService();

            model.ReceiveSamples = visitService.ReceiveSample(userId);

            return(RedirectToAction("ReceiveSample"));
        }
Exemplo n.º 2
0
        public ActionResult ReceiveSample(int id = 1)
        {
            Session["Choice"] = id == 1 ? "Concrete" : "Block";

            var userId = Convert.ToInt32(Session["UserId"].ToString());

            VisitDetailsModel model        = new VisitDetailsModel();
            VisitService      visitService = new VisitService();

            if (@Session["JobTitle"].ToString() == "Admin")
            {
                model.ReceiveSamples = visitService.ReceiveSample();
            }
            else
            {
                model.ReceiveSamples = visitService.ReceiveSample(userId);
            }
            return(View(model));
        }