public JsonResult CreateDog(Dog dog)
        {
            dog.Dogtype = dog.Dogtype.Where(x => !string.IsNullOrEmpty(x.ToLower())).ToArray();
            StringBuilder msg = new StringBuilder();

            try
            {
                if (ModelState.IsValid)
                {
                    _dogService.Add(dog);
                    return(Json("Saved Successfully", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    var errorList = (from item in ModelState
                                     where item.Value.Errors.Any()
                                     select item.Value.Errors[0].ErrorMessage).ToList();

                    return(Json(errorList, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                var errormessage = "Error occured: " + ex.Message;
                return(Json(errormessage, JsonRequestBehavior.AllowGet));
            }
        }
        public IActionResult PostDog([FromBody] CreateDogDto dog)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var createdDog = _dogService.Add(dog);

            return(CreatedAtAction("GetDog", new { id = createdDog.Id }, createdDog));
        }
        public void AddReport(CreateReportDto report)
        {
            var dog = _dogService.Add(report.Dog);

            var reportEntity = new ReportEntity
            {
                ContactEmail  = report.ContactEmail,
                ContactNumber = report.ContactNumber,
                DateReported  = DateTime.UtcNow,
                DogId         = dog.Id
            };

            _reportRepository.SaveAll();
            _reportRepository.AddReport(reportEntity);
            _reportRepository.SaveAll();
        }