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));
        }
Beispiel #2
0
        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));
            }
        }
Beispiel #3
0
 public async Task Add(DogDTO dog)
 {
     await _repository.Add(_mapper.mapper.Map <Dog>(dog));
 }
Beispiel #4
0
        public int Add(DogViewModel dogModel)
        {
            Dog dog = _mapper.Map <DogViewModel, Dog>(dogModel);

            return(_repository.Add(dog));
        }