Ejemplo n.º 1
0
        public bool CreateChurch(ChurchCreate model)
        {
            Church church = new Church()
            {
                ChurchName  = model.ChurchName,
                ChurchCity  = model.ChurchCity,
                ChurchState = model.ChurchState
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Churches.Add(church);
                return(ctx.SaveChanges() == 1);
            }
        }
Ejemplo n.º 2
0
        public IHttpActionResult Post(ChurchCreate church)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = new ChurchService();

            if (!service.CreateChurch(church))
            {
                return(InternalServerError());
            }

            return(Ok());
        }