public ActionResult Create([Bind(Include = "DogId,Name,PictureAddress,ShelterId,BreedId,Availability")] Dog dog)
        {
            if (ModelState.IsValid)
            {
                db.Add(dog);
                return(RedirectToAction("Index"));
            }

            return(View(dog));
        }
        public ActionResult Create(Dog dog)
        {
            try
            {
                // update the dogs OwnerId to the current user's Id
                dog.OwnerId = GetCurrentUserId();

                _dogRepository.Add(dog);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View(dog));
            }
        }
Exemple #3
0
 public async Task Add(DogDTO dog)
 {
     await _repository.Add(_mapper.mapper.Map <Dog>(dog));
 }
        public int Add(DogViewModel dogModel)
        {
            Dog dog = _mapper.Map <DogViewModel, Dog>(dogModel);

            return(_repository.Add(dog));
        }