Example #1
0
        public APIResult SaveEvent(SaveEventViewModel model)
        {
            try
            {
                if (model == null)
                    throw new Exception("Please pass model");

                using (var bo = new ApplicationBusinessObject())
                {
                    if (!bo.Check(model.ApplicationId, model.ApplicationSecretKey))
                        throw new Exception("Invalid application credentials");
                }

                using (var bo = new EventBusinessObject())
                {
                    var item = new Event
                    {
                        ApplicationId = model.ApplicationId,
                        Key = model.Key,
                        Description = model.Description
                    };

                    bo.Save(item);
                }
            }
            catch (Exception ex)
            {
                return new APIResult(ex.Message, ex.ToString());
            }

            return new APIResult();
        }