Exemplo n.º 1
0
 /// <summary>
 /// Get State By StateId
 /// </summary>
 /// <param name="stateId">Int32:stateId</param>
 /// <returns></returns>
 public StateDTO GetStateByStateId(int stateId)
 {
     StateDTO stateDetail = new StateDTO();
     AutoMapper.Mapper.Map(ESalesUnityContainer.Container.Resolve<IGenericRepository<state>>()
         .GetSingle(item => item.State_Id == stateId), stateDetail);
     
     //return value
     return stateDetail;
 }
Exemplo n.º 2
0
 /// <summary>
 /// To Update State
 /// </summary>
 /// <param name="stateDetail"></param>
 /// <returns></returns>
 public int UpdateState(StateDTO stateDetail)
 {
     state stateEntity = new state();
     AutoMapper.Mapper.Map(stateDetail, stateEntity);
     ESalesUnityContainer.Container.Resolve<IGenericRepository<state>>().Update(stateEntity);
     
     //return value
     return stateEntity.State_Id;          
 }
Exemplo n.º 3
0
        /// <summary>
        /// Verify State exists or not by stateId,state
        /// </summary>
        /// <param name="stateId">Int32:stateId</param>
        /// <param name="state">string:state</param>
        /// <returns></returns>
        public bool StateExists(int stateId, string state)
        {
            StateDTO stateDetails = new StateDTO();
            bool result = false;

            if (stateId == 0)
            {
                AutoMapper.Mapper.Map(ESalesUnityContainer.Container.Resolve<IGenericRepository<state>>()
                    .GetSingle(item => item.State_Name == state && item.State_IsDeleted == false), stateDetails);
            }
            else
            {
                AutoMapper.Mapper.Map(ESalesUnityContainer.Container.Resolve<IGenericRepository<state>>()
                    .GetSingle(item=>item.State_Name == state && item.State_IsDeleted == false
                        && item.State_Id != stateId), stateDetails);
            }

            if (stateDetails.State_Id > 0)
            {
                result = true;
            }
            return result;
        }