예제 #1
0
        public async Task <ActionResult> TakePlace(int RowNumber, int PlaceNumber)
        {
            try
            {
                var dbPlace = await _placesService.GetPlaceByRowAndPlaceNumber(RowNumber, PlaceNumber);

                if (dbPlace != null)
                {
                    await _placesService.Remove(dbPlace);
                }
                else
                {
                    var _place = new Place
                    {
                        PlaceNumber = PlaceNumber,
                        Row         = RowNumber
                    };
                    await _placesService.SavePlace(_place);
                }

                return(Json(new
                {
                    Success = true,
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    Success = false,
                    Message = ex.Message
                }, JsonRequestBehavior.AllowGet));
            }
        }