Beispiel #1
0
        public string Post([FromBody] string value)
        {
            ValidateRequest();
            UserEventParam getWishParam   = JsonConvert.DeserializeObject <UserEventParam>(value);
            IWishReader    wReader        = new WishReader();
            Wish           particularWish = wReader.GetWishForUserAndEvent(getWishParam);

            return(JsonConvert.SerializeObject(particularWish));
        }
Beispiel #2
0
        private void ValidateDuplicatedWish(Wish wish)
        {
            UserEventParam checkExistingParam = new UserEventParam {
                EventId = (int)wish.EventId, OwnerId = (int)wish.OwnerId
            };

            if (wReader.GetWishForUserAndEvent(checkExistingParam) != null)
            {
                throw new WishAlreadyExistsException("A wish for this user and event already exists.");
            }
        }
Beispiel #3
0
        public Wish GetWishForUserAndEvent(UserEventParam param)
        {
            string getWishes = $"select * from wishes where OwnerId = {param.OwnerId} and eventid = {param.EventId}";

            return(dbr.GetSingleOrDefault <Wish>(getWishes));
        }