public int Post([FromBody] StateEntity stateEntity) { if (stateEntity != null) { return(stateServices.AddState(stateEntity)); } return(0); }
public int Post([FromBody] StateViewModel state) { if (state != null) { Mapper.Initialize(cfg => cfg.CreateMap <StateViewModel, StateEntity>()); var stateEntity = Mapper.Map <StateViewModel, StateEntity>(state); return(stateServices.AddState(stateEntity)); } return(0); }