コード例 #1
0
        public ActionResult servicesRegister(servicesofferedtbl serviceRegModel)
        {
            servicesofferedtbl servicetblvals = new servicesofferedtbl();

            using (dbPatientBillingEntities5 dbServiceModel = new dbPatientBillingEntities5())
            {
                if (dbServiceModel.servicesofferedtbls.Any(x => x.Service_Description == serviceRegModel.Service_Description))
                {
                    ViewBag.Duplicatemsg = "Service already exist.";
                    return(View("servicesRegister", serviceRegModel));
                }
                else
                {
                    servicetblvals.Service_Description = serviceRegModel.Service_Description;
                    servicetblvals.Cost_Of_Service     = serviceRegModel.Cost_Of_Service;
                }
                dbServiceModel.servicesofferedtbls.Add(servicetblvals);
                dbServiceModel.SaveChanges();
            }
            ModelState.Clear();
            ViewBag.SuccessMessage = "Service Added Sucessfully.";
            return(View("servicesRegister", serviceRegModel));

            #endregion
        }
コード例 #2
0
        public ActionResult servicesRegister()
        {
            dbPatientBillingEntities5 dbServiceModel  = new dbPatientBillingEntities5();
            servicesofferedtbl        serviceRegModel = new servicesofferedtbl();
            var viewName = dbServiceModel.servicesofferedtbls.ToList();

            ViewBag.viewName = viewName;
            return(View(serviceRegModel));
        }