public bool CreateMove(MoveCreate model) { var entity = new Move() { MoveName = model.MoveName, Damage = model.Damage, CreatedUtc = DateTimeOffset.Now }; using (var ctx = new ApplicationDbContext()) { ctx.MoveDb.Add(entity); return(ctx.SaveChanges() == 1); } }
public IHttpActionResult Post(MoveCreate move) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateMoveService(); if (!service.CreateMove(move)) { return(InternalServerError()); } return(Ok()); }
public bool CreateMove(MoveCreate model) { var entity = new Move() { MoveName = model.MoveName, Accuracy = model.Accuracy, Power = model.Power, Description = model.Description, TypeID = model.MoveTypeID }; using (var ctx = new ApplicationDbContext()) { ctx.MoveDb.Add(entity); return(ctx.SaveChanges() == 1); } }