コード例 #1
0
        public async Task <ActionResult> Create([FromForm] Event model)
        {
            try
            {
                var request = await _manager.CreateActivity(model);

                if (request.Item1)
                {
                    return(Json(new { status = request.Item1, data = "Event successfully created" }));
                }
                return(Json(new { status = request.Item1, data = request.Item2 }));
            }
            catch
            {
                return(View());
            }
        }
コード例 #2
0
        public async Task <ActionResult <Activities> > PostActivities(ActivitiesDTO activities)
        {
            var activity = await _context.CreateActivity(activities);

            return(CreatedAtAction("GetActivities", new { id = activity.ID }, activity));
        }