Exemplo n.º 1
0
        public static AppLab_Test AddMixReport(CreateMixReportModel source)
        {
            var test = new Lab_Tests
            {
                Name     = source.Name,
                Fee      = source.Fee,
                Interval = 30,
                Status   = true,
            };

            using (var dbContext = new HMSEntities())
            {
                test.CreationDate = DateTime.Now;
                dbContext.Lab_Tests.Add(test);
                dbContext.SaveChanges();


                foreach (var obj in source.ParmIds)
                {
                    var testMapping = new Lab_Mapping
                    {
                        TestId       = test.Id,
                        ParmId       = obj,
                        CreationDate = DateTime.Now
                    };
                    dbContext.Lab_Mapping.Add(testMapping);
                }
                dbContext.SaveChanges();

                return(test.Mapper());
            }
        }
Exemplo n.º 2
0
        public JsonResult CreateMixReport(CreateMixReportModel request)
        {
            var lab = LabService.AddMixReport(request);

            return(Json(lab, JsonRequestBehavior.AllowGet));
        }