Esempio n. 1
0
        public async Task <ResponseResult <User> > UpdateUser(User user)
        {
            try
            {
                _context.Users.Update(user);
                await _context.SaveChangesAsync();

                return(new ResponseResult <User> {
                    Error = false, Message = "user updated successfully", ReturnResult = user
                });
            }
            catch (Exception ex)
            {
                return(new ResponseResult <User> {
                    Error = true, Message = ex.Message, ReturnResult = user
                });
            }
        }
Esempio n. 2
0
        public async Task <ResponseResult <Offer> > UpdateOffer(Offer offer)
        {
            try
            {
                _context.Offers.Update(offer);
                await _context.SaveChangesAsync();

                return(new ResponseResult <Offer> {
                    Error = false, Message = "court updated successfully", ReturnResult = offer
                });
            }
            catch (Exception ex)
            {
                return(new ResponseResult <Offer> {
                    Error = true, Message = ex.Message, ReturnResult = offer
                });
            }
        }
Esempio n. 3
0
        public async Task <ResponseResult <Gym> > UpdateGym(Gym gym)
        {
            try
            {
                _context.Gyms.Update(gym);
                await _context.SaveChangesAsync();

                return(new ResponseResult <Gym> {
                    Error = false, Message = "court updated successfully", ReturnResult = gym
                });
            }
            catch (Exception ex)
            {
                return(new ResponseResult <Gym> {
                    Error = true, Message = ex.Message, ReturnResult = gym
                });
            }
        }
Esempio n. 4
0
        public async Task <ResponseResult <Court> > AddNewCourt(Court newCourt)
        {
            bool   flag    = false;
            string message = "";

            try
            {
                _context.Courts.Add(newCourt);
                message = "Court added successfully";
                await _context.SaveChangesAsync();
            }
            catch (Exception ex) {
                flag    = true;
                message = ex.Message;
            }
            return(new ResponseResult <Court> {
                Error = flag, Message = message, ReturnResult = newCourt
            });
        }