// Called from Index (only id) or Edit (id and delete) view
        public ActionResult Edit(int?id, bool?delete)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            IPacjentService service = new PacjentService();
            PacjentModel    pacjent = new PacjentModel();

            pacjent = service.GetPacjentById(id.Value);

            if (pacjent == null)
            {
                return(HttpNotFound());
            }

            if (delete.HasValue)
            {
                service.DeletePacjent(pacjent);
                return(RedirectToAction("Index"));
            }

            return(View(pacjent));
        }
Пример #2
0
        public PacjentModel GetPacjentById(int pacjentId)
        {
            IRepository <PacjentModel> pacjentRepository = new Repository <PacjentModel>();
            PacjentModel pacjent = pacjentRepository.FindById(pacjentId);

            return(pacjent);
        }
Пример #3
0
        public void DeletePacjentById(int pacjentId)
        {
            IRepository <PacjentModel> pacjentRepository = new Repository <PacjentModel>();
            PacjentModel pacjent = pacjentRepository.FindById(pacjentId);

            pacjentRepository.Delete(pacjent);
        }
        public ActionResult Edit(PacjentModel pacjent)
        {
            if (ModelState.IsValid)
            {
                IPacjentService service = new PacjentService();
                service.EditPacjent(pacjent);

                return(RedirectToAction("Index"));
            }

            return(View(pacjent));
        }
Пример #5
0
        public void DeletePacjent(PacjentModel pacjent)
        {
            IRepository <PacjentModel> pacjentRepository = new Repository <PacjentModel>();

            pacjentRepository.Delete(pacjent);
        }
Пример #6
0
        public void EditPacjent(PacjentModel pacjent)
        {
            IRepository <PacjentModel> pacjentRepository = new Repository <PacjentModel>();

            pacjentRepository.Update(pacjent);
        }
Пример #7
0
        public void AddPacjent(PacjentModel pacjent)
        {
            IRepository <PacjentModel> pacjentRepository = new Repository <PacjentModel>();

            pacjentRepository.Add(pacjent);
        }