Ejemplo n.º 1
0
        public ActionResult customMatrialCreate(CustomMaterialViewModel customMaterialViewModel)
        {
            try
            {
                if (ModelState.IsValid && customMaterialViewModel.Name != null)
                {
                    customMaterialViewModel.RequestDate = DateTime.Now;
                    customMaterialViewModel.PatientID   = getCurrentPatientID();
                    customMaterialViewModel.DoctorID    = getDoctorIDbyUserID();
                    customMaterialViewModel.clinecid    = getUserCurrentClinecID();

                    bool check = customMatrialRepository.addNewCustomMaterial(customMaterialViewModel);
                }
                else
                {
                    return(View());
                }

                return(RedirectToAction("customMatrialList"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 2
0
        public bool updateCustomMaterial(CustomMaterialViewModel customMaterialViewModel)
        {
            int count = 0;

            using (Entities.Entities ctx = new Entities.Entities())
            {
                CustomMaterial customMatrailEntity = ctx.CustomMaterials.Find(customMaterialViewModel.CustomMaterialID);

                customMatrailEntity.ReciveDate       = customMaterialViewModel.ReciveDate;
                customMatrailEntity.Name             = customMaterialViewModel.Name;
                customMatrailEntity.Description      = customMaterialViewModel.Description;
                customMatrailEntity.Cost             = customMaterialViewModel.Cost;
                customMatrailEntity.Payed            = customMaterialViewModel.payed == 1 ? true : false;
                ctx.Entry(customMatrailEntity).State = System.Data.Entity.EntityState.Modified;
                count = ctx.SaveChanges();
            }
            return(count > 0 ? true : false);
        }
Ejemplo n.º 3
0
 public ActionResult customMatrialEdit(CustomMaterialViewModel customMaterialViewModel)
 {
     try
     {
         if (ModelState.IsValid && customMaterialViewModel.Name != null)
         {
             bool check = customMatrialRepository.updateCustomMaterial(customMaterialViewModel);
         }
         else
         {
             return(View(customMaterialViewModel));
         }
         return(RedirectToAction("customMatrialList", new { patientID = customMaterialViewModel.PatientID }));
     }
     catch
     {
         return(View(customMaterialViewModel));
     }
 }
Ejemplo n.º 4
0
        public bool addNewCustomMaterial(CustomMaterialViewModel customMaterialViewModel)
        {
            int count = 0;

            using (Entities.Entities ctx = new Entities.Entities())
            {
                CustomMaterial customMatrailEntity = ctx.CustomMaterials.Create();

                customMatrailEntity.DoctorID    = customMaterialViewModel.DoctorID;
                customMatrailEntity.PatientID   = customMaterialViewModel.PatientID;
                customMatrailEntity.RequestDate = customMaterialViewModel.RequestDate;
                customMatrailEntity.Name        = customMaterialViewModel.Name;
                customMatrailEntity.Description = customMaterialViewModel.Description;
                customMatrailEntity.Cost        = customMaterialViewModel.Cost;
                customMatrailEntity.ClinicID    = customMaterialViewModel.clinecid;
                customMatrailEntity.Payed       = false;

                ctx.CustomMaterials.Add(customMatrailEntity);
                count = ctx.SaveChanges();
            }
            return(count > 0 ? true : false);
        }