Ejemplo n.º 1
0
        public ActionResult <object> Post(Citizens citizen)
        {
            DALOps dal = new DALOps(connStr, database);

#if DALChanges1
            var coll = dal.GetCollectionCount(collection);
#else
            var coll = dal.GetCollectionCount(dal, collection);
#endif
            citizen.citizenid = "PH" + (coll + 1).ToString();

#if DALChanges1
            var dotNetObj = dal.InsertToCollection(collection, citizen);
#else
            var dotNetObj = dal.InsertToCollection(dal, collection, citizen);
#endif
            return(dotNetObj);
        }
Ejemplo n.º 2
0
        //[Route("api/[controller]/Post")]
        public IActionResult Post([FromBody] Persons person)
        {
            DALOps dal  = new DALOps(connStr, database);
            var    coll = dal.GetCollectionCount(dal, collection);

            person.personid = "PH" + (coll + 1).ToString();
            var dotNetObj = dal.InsertToCollection(dal, collection, person);

            return(Ok(dotNetObj));
        }