コード例 #1
0
        public ActionResult ViewAccidentWithAnswer(int id)
        {
            var accident = this.accidentService.GetById(id);

            if (!this.IsMegaAdmin())
            {
                if (accident.FromId != this.User.Identity.GetUserId())
                {
                    return(Redirect("/Home/NotAuthorized"));
                }
            }

            var viewModel = new ViewAccidentViewModel
            {
                DateOfSend = accident.DateOfSend.ToString(),
                From       = (accident.From.FirstName + accident.From.SecondName + accident.From.LastName) == "" ?
                             accident.From.Email : accident.From.FirstName + " " + accident.From.SecondName + " " + accident.From.LastName,
                Id          = accident.Id,
                Message     = accident.Message,
                Answer      = accident.Answer,
                DateOfRaply = accident.ReplyingDate.ToString()
            };

            //Set accident is seen
            this.accidentService.SetSeenByUser(id);

            return(View(viewModel));
        }
コード例 #2
0
        public ActionResult ViewAccident(int id)
        {
            var accident = this.accidentService.GetById(id);

            //Verify if the accident is from user organisation
            if (!this.IsMegaAdmin())
            {
                if (accident.From.Site.OrganisationId != this.userService.GetUserOrganisationId(this.User.Identity.GetUserId()))
                {
                    return(Redirect("/Home/NotAuthorized"));
                }
            }
            var viewModel = new ViewAccidentViewModel
            {
                DateOfSend = accident.DateOfSend == DateTime.MinValue ? " - " : accident.DateOfSend.ToString(),
                From       = (accident.From.FirstName + accident.From.SecondName + accident.From.LastName) == "" ?
                             accident.From.Email : accident.From.FirstName + " " + accident.From.SecondName + " " + accident.From.LastName,
                Id      = accident.Id,
                Message = accident.Message
            };

            if (accident.ReplyingDate != null)
            {
                viewModel.DateOfRaply = accident.ReplyingDate.ToString() == "1.1.0001 г. 0:00:00" ? "-" : accident.ReplyingDate.ToString();
            }
            return(View(viewModel));
        }
コード例 #3
0
        public ActionResult ViewAccidentToAnswer(int id)
        {
            var accident = this.accidentService.GetById(id);

            //Verify if the accident is from user organisation
            if (!this.IsMegaAdmin())
            {
                if (accident.From.Site.OrganisationId != this.userService.GetUserOrganisationId(this.User.Identity.GetUserId()))
                {
                    return(Redirect("/Home/NotAuthorized"));
                }
            }

            var viewModel = new ViewAccidentViewModel
            {
                DateOfSend = accident.DateOfSend.ToString(),
                From       = (accident.From.FirstName + accident.From.SecondName + accident.From.LastName) == "" ?
                             accident.From.Email : accident.From.FirstName + " " + accident.From.SecondName + " " + accident.From.LastName,
                Id      = accident.Id,
                Message = accident.Message
            };

            return(View(viewModel));
        }