예제 #1
0
        public void Create(IssueInputModel inputModel)
        {
            var issue = new Issue
            {
                Description = inputModel.Description,
                CarId       = inputModel.carId,
                IsFixed     = false,
            };

            this.db.Issues.Add(issue);
            this.db.SaveChanges();
        }
예제 #2
0
        public HttpResponse Add(IssueInputModel inputModel)
        {
            if (!this.IsUserSignedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            if (string.IsNullOrWhiteSpace(inputModel.Description) || inputModel.Description.Length < 5)
            {
                return(this.Error("Issue description is required and should be more then 5 symbols."));
            }

            this.issuesService.Create(inputModel);

            return(this.Redirect($"/Issues/CarIssues?carId={inputModel.carId}"));
        }
        public HttpResponse Add(string carId, IssueInputModel input)
        {
            if (!this.IsUserSignedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            if (string.IsNullOrWhiteSpace(input.Description) || input.Description.Length < 5)
            {
                return(this.Error("Invalid description. The description should be more than 5 symbols!"));
            }

            this.issuesService.Add(input.Description, carId);

            return(this.CarIssues(carId));
        }