Exemplo n.º 1
0
        public DrugViewModel Create(DrugPostModel model)
        {
            var drugModel = new DrugModel
            {
                Name = model.Name,
                MedicinalSubstance = model.MedicinalSubstance,
                FormId             = model.FormId
            };

            var createResult = _drugService.Create(drugModel);

            var result = new DrugViewModel
            {
                Id   = createResult.Id,
                Name = createResult.Name,
                MedicinalSubstance = createResult.MedicinalSubstance,
                Form = "Unknown"
            };

            return(result);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var repository = new DrugsEFRepository();
            var service    = new DrugServise(repository);
            var controller = new DrugsController(service);

            var drugPostModel = new DrugPostModel
            {
                Name = "Isoniazid Entity Frame",
                MedicinalSubstance = "Isoniazid Entity",
                FormId             = 1,
            };

            controller.Create(drugPostModel);

            var drugs = controller.GetAll();



            System.Console.WriteLine(drugs);
            System.Console.ReadLine();
        }