Ejemplo n.º 1
0
        public bool Delete(int id)
        {
            PatronusRepository patronusRepository = new PatronusRepository();

            try
            {
                patronusRepository.Delete(id);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 public bool Post(PatronusModel patronusModel)
 {
     try
     {
         PatronusRepository patronusRepository = new PatronusRepository();
         Patronus           patronus           = new Patronus();
         patronus.Identifier = patronusModel.Identifier;
         patronusRepository.Insert(patronus);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        public bool Update(PatronusModel patronusModel)
        {
            PatronusRepository patronusRepository = new PatronusRepository();
            Patronus           patronus           = new Patronus();

            try
            {
                patronus.Id         = patronusModel.Id;
                patronus.Identifier = patronusModel.Identifier;
                patronusRepository.Update(patronus);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        public PatronusModel GetById(int id)
        {
            PatronusRepository patronusRepository = new PatronusRepository();

            try
            {
                Patronus      patronus      = patronusRepository.GetById(id);
                PatronusModel patronusModel = new PatronusModel();
                patronusModel.Id         = patronus.Id;
                patronusModel.Identifier = patronus.Identifier;

                return(patronusModel);
            }
            catch
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
        public List <PatronusModel> Get()
        {
            PatronusRepository patronusRepository = new PatronusRepository();

            try
            {
                List <Patronus>      patronuss      = patronusRepository.Get();
                List <PatronusModel> patronusModels = new List <PatronusModel>();
                foreach (Patronus patronus in patronuss)
                {
                    PatronusModel patronusModel = new PatronusModel();
                    patronusModel.Id         = patronus.Id;
                    patronusModel.Identifier = patronus.Identifier;

                    patronusModels.Add(patronusModel);
                }
                return(patronusModels);
            }
            catch
            {
                return(null);
            }
        }