Exemplo n.º 1
0
        public JsonResult CanReceiveProductGifts(int destinationID)
        {
            try
            {
                var source      = SessionHelper.CurrentEntity;
                var destination = entityRepository.GetById(destinationID);

                MethodResult result = giftService.CanReceiveProductGifts(source, destination);

                if (result.IsError)
                {
                    return(JsonData(new { result = false, error = result.Errors[0] }));
                }

                return(JsonData(new { result = true, error = "" }));
            }
            catch (Exception e)
            {
                return(JsonError("Undefined error!"));
            }
        }