예제 #1
0
        public async Task <IActionResult> Create([Bind("MembershipId,Title,Frequency,Spot,SpotSeats,NoOfDays,DayPart,WeekPart,Price,Benefits")] Membership membership)
        {
            if (ModelState.IsValid)
            {
                await _membershipRepository.AddAsync(membership);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(membership));
        }
        public async Task <MembershipResponse> SaveAsync(Membership membership)
        {
            try
            {
                await _membershipRepository.AddAsync(membership);

                return(new MembershipResponse(membership));
            }
            catch (Exception ex)
            {
                return(new MembershipResponse($"An error ocurred while saving the membership : {ex.Message}"));
            }
            throw new NotImplementedException();
        }