コード例 #1
0
        public IActionResult Put(Event model)
        {
            if (ModelState.IsValid)
            {
                if (_srv.GetEvent(model.EventID) != null)
                {
                    Event UpdatedEvent = model;
                    // UpdatedEvent.Name = model.Name;
                    // UpdatedEvent.DateTime = model.DateTime;
                    // UpdatedEvent.Location = model.Location;
                    // UpdatedEvent.Info = model.Info;

                    if (_srv.PutEvent(UpdatedEvent))
                    {
                        return(Ok());
                    }
                    return(BadRequest("Putting event failed!"));
                }
                return(NotFound($"Couldn't find event with id: \"{model.EventID}\"!"));
            }
            return(BadRequest("Event model is invalid!"));
        }