Beispiel #1
0
        public ActionResult Details(int id)
        {
            var service = _serviceService.Get(id).Data;
            var model   = Mapper.Map <ServiceMvcViewModel>(service);

            return(View(model));
        }
Beispiel #2
0
        public IActionResult GetDetails(int Id)
        {
            var model = lawyerService.GetLawyer(Id);

            model.Services = ServiceService.Get(Id);
            return(Ok(model));
        }
        public ActionResult Edit(EditEmployeDTO personne)
        {
            AffectationService nouvelleAffectation = new AffectationService();
            Employe            employeOrigine      = new Employe();

            //On prépare la nouvelle affectation
            if (personne.serviceIdPourAffectation != 0 && personne.groupeIdPourAffectation != 0)
            {
                nouvelleAffectation.isPrincipal = personne.isAffecttionPrincipal;
                nouvelleAffectation.service     = _serviceService.Get(personne.serviceIdPourAffectation);
                nouvelleAffectation.groupe      = _droitService.Get(personne.groupeIdPourAffectation);
            }

            if (personne.id != 0)//update
            {
                try
                {
                    employeOrigine = _employeService.Get(personne.id);

                    _insertOrUpdateAffectation(ref employeOrigine, nouvelleAffectation);

                    _employeService.Update(employeOrigine, _donneNomPrenomUtilisateur());
                    _employeService.Save();

                    FlashMessage.Confirmation("Employé mis à jour avec succès");
                }
                catch (Exception e)
                {
                    FlashMessage.Danger("Erreur lors de mis à jour de l'employé");
                }
            }
            else//create
            {
                try
                {
                    employeOrigine = Mapper.Map <EditEmployeDTO, Employe>(personne);


                    employeOrigine.utilisateur.password = _utilisateurService.Crypte(Parametres.defaultPassword);
                    employeOrigine.affectationServices.Add(nouvelleAffectation);
                    employeOrigine.utilisateur.login = employeOrigine.nom.ToUpper() + '.' + employeOrigine.prenom.ToUpper().First();

                    //On prépare le type d'employé
                    employeOrigine.typeEmploye = _temployeService.Get(personne.typeEmploye.id);
                    _employeService.Create(employeOrigine, _donneNomPrenomUtilisateur());

                    FlashMessage.Confirmation("Employé créé avec succès");
                }
                catch (Exception e)
                {
                    FlashMessage.Danger("Erreur lors de l'ajout de l'employé");
                }
            }
            _employeService.Save();

            return(RedirectToAction("Index", "Employe", new { area = "RessourcesHumaines" }));
        }
Beispiel #4
0
 public IActionResult Get()
 {
     try
     {
         var serviceDto = _serviceService.Get();
         return(Ok(serviceDto));
     }
     catch (System.Exception ex)
     {
         return(BadRequest(new { message = ex.Message }));
     }
 }
        public ServicesViewModel(IServiceService serviceService)
        {
            this.serviceService = serviceService;


            Services = serviceService.Get();
        }
Beispiel #6
0
        public ActionResult Show(string slug)
        {
            var model = _serviceService.Get(slug);

            if (model == null)
            {
                throw new HttpException((int)HttpStatusCode.NotFound, "Service couldn't be not found.");
            }

            return(View(model));
        }
Beispiel #7
0
        public async Task <ActionResult <ServiceDTO> > GetByCodeAsync(string serviceCode)
        {
            if (string.IsNullOrWhiteSpace(serviceCode))
            {
                throw new ArgumentNullException(nameof(serviceCode));
            }

            var dto = await _cache.GetOrAddAsync(KakaduConstants.GetServiceKey(serviceCode), async (options) => {
                options.AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(3);

                var entity = await Task.Run(() => _service.Get(serviceCode));
                if (entity == null)
                {
                    throw new HttpNotFoundException($"No service definition found for '{serviceCode}'");
                }

                return(_mapper.Map <ServiceDTO>(entity));
            });

            return(dto);
        }
Beispiel #8
0
        public ActionResult Service(int id, string error)
        {
            var service = _serviceService.Get(id);

            if (service.Succeeded && string.IsNullOrEmpty(error))
            {
                var model = new BookedServiceMvcViewModel
                {
                    ServiceId   = service.Data.Id,
                    ServiceName = service.Data.Name,
                    Price       = service.Data.Price
                };

                return(View("SingleService", model));
            }

            return((string.IsNullOrEmpty(error))
                ? (ActionResult)RedirectToAction("Services")
                : View("SingleService", new BookedServiceMvcViewModel {
                Error = error
            }));
        }
Beispiel #9
0
        public ActionResult <Service> GetService(Guid serviceId = new Guid())
        {
            var result = _serviceService.Get(serviceId);

            return(Ok(result));
        }
        public async Task <OkObjectResult> Get(int id)
        {
            var result = await serviceService.Get(id);

            return(Ok(result));
        }
Beispiel #11
0
 public async Task <IEnumerable <Service> > Get()
 {
     return(await serviceService.Get());
 }
Beispiel #12
0
        public ActionResult Form(int id)
        {
            var service = _service.Get(id);

            return(View(service));
        }