Beispiel #1
0
        public void Update(TypeMedicine item)
        {
            var typeMedicineEntity = new TypeMedicineEntity();

            typeMedicineMapper.MapToEntity(item, typeMedicineEntity);
            typeMedicineRepository.Update(typeMedicineEntity);
        }
Beispiel #2
0
        public void Add(TypeMedicine item)
        {
            var entity = new TypeMedicineEntity();

            typeMedicineMapper.MapToEntity(item, entity);
            typeMedicineRepository.Create(entity);
        }
Beispiel #3
0
        public TypeMedicine GetItemById(int id)
        {
            var entity = typeMedicineRepository.GetItemById(id);

            if (entity != null)
            {
                var typeMedicine = new TypeMedicine();
                typeMedicineMapper.MapFromEntity(entity, typeMedicine);
                return(typeMedicine);
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
        public IList <TypeMedicine> GetAll()
        {
            var typeMedicineEntities = typeMedicineRepository.GetList();
            var TypeMedicines        = new List <TypeMedicine>();

            if (typeMedicineEntities.Any())
            {
                foreach (var typeMedicineEntity in typeMedicineEntities)
                {
                    var typeMedicine = new TypeMedicine();
                    typeMedicineMapper.MapFromEntity(typeMedicineEntity, typeMedicine);
                    TypeMedicines.Add(typeMedicine);
                }
            }

            return(TypeMedicines);
        }
Beispiel #5
0
        public void MapFromEntity(MedicineEntity medicineEntity, Medicine medicine)
        {
            if (medicineEntity != null && medicine != null)
            {
                medicine.Id          = medicineEntity.Id;
                medicine.Cost        = medicineEntity.Cost;
                medicine.MethodUsing = medicineEntity.MethodUsing;
                medicine.Name        = medicineEntity.Name;

                if (medicineEntity.TypeMedicine != null)
                {
                    var typeMedicine = new TypeMedicine();
                    typeMedicineMapper.MapFromEntity(medicineEntity.TypeMedicine, typeMedicine);
                    medicine.CurrentTypeMedicine = typeMedicine;
                }
            }
        }
Beispiel #6
0
 public ContentResult Update(TypeMedicine typeMedicine)
 {
     typeMedicineService.Update(typeMedicine);
     typeMedicineService.Save();
     return(Content("<p>The medicine's type was updated successfully!</p>"));
 }
Beispiel #7
0
 public ContentResult CreateTypeMedicine(TypeMedicine typeMedicine)
 {
     typeMedicineService.Add(typeMedicine);
     typeMedicineService.Save();
     return(Content("<p>The medicine's type was created successfully!</p>"));
 }