Ejemplo n.º 1
0
        public DamageReportCompleteOutputDto ModifyDamageReport(string token, int id, ModifyDamageReportDto modifiedDamage)
        {
            _credentialsVerifier.VerifyCredentialsForModifyingDamageReports(token);

            DamageReport damageReport = _damageReportsRepository.Get(id);

            DamageStatus oldStatus = damageReport.Status;

            _objectMapper.Map(modifiedDamage, damageReport);

            DamageStatus newStatus = damageReport.Status;

            CheckIfDamageIsModifiable(damageReport);

            if (modifiedDamage.Status == DamageStatusDto.Repairing)
            {
                damageReport.CrewMemberThatRepairedTheDamage = _userRepository.Get(modifiedDamage.Crew.Id) as Crew;
            }

            CurrentUnitOfWork.SaveChanges();

            NotifyStatusChange(oldStatus, newStatus);

            return(_objectMapper.Map <DamageReportCompleteOutputDto>(damageReport));
        }
Ejemplo n.º 2
0
        public DamageReportCompleteOutputDto ModifyDamageReport(int id, ModifyDamageReportDto modifiedDamage)
        {
            string token = Utillities.GetTokenFromRequest(Request);

            return(_damageAppService.ModifyDamageReport(token, id, modifiedDamage));
        }