Ejemplo n.º 1
0
        public IActionResult Add(AddProvinceViewModel province)
        {
            ProvinceBusiness provinceBusiness = new ProvinceBusiness();
            var result = provinceBusiness.AddProvince(province);

            return(Ok(result));
        }
        public async Task <ActionResult> Add(AddProvinceViewModel Province)
        {
            Province.CreatedBy = _userSessionHelper.GetUserSession().UserName;
            string apiUrl = _appUrlHelper.GetApiUrl(ApiUrlPath.PROVINCE_ADD);
            var    result = await HttpUtilities.PostAsyncApi <ReturnResult <Province> >(apiUrl, JsonConvert.SerializeObject(Province));

            return(Json(result));
        }
Ejemplo n.º 3
0
        public ReturnResult <Province> Add(AddProvinceViewModel province)
        {
            DbProvider dbProvider = new DbProvider();
            string     outCode    = String.Empty;
            string     outMessage = String.Empty;
            StoredProcedureConfigs <Province> storedProcedureConfigs = new StoredProcedureConfigs <Province>();

            dbProvider.SetQuery(storedProcedureConfigs._INSERT_SINGLE_STORED_PROCEDURE, CommandType.StoredProcedure)
            .SetParameter("Name", SqlDbType.NVarChar, province.Name, ParameterDirection.Input)
            .SetParameter("Status", SqlDbType.Int, province.Status, ParameterDirection.Input)
            .SetParameter("CreatedBy", SqlDbType.NVarChar, province.CreatedBy, ParameterDirection.Input)
            .SetParameter("ERROR_CODE", SqlDbType.NVarChar, DBNull.Value, 100, ParameterDirection.Output)
            .SetParameter("ERROR_MESSAGE", SqlDbType.NVarChar, DBNull.Value, 400, ParameterDirection.Output)
            .ExcuteNonQuery()
            .Complete();
            dbProvider.GetOutValue("ERROR_CODE", out outCode)
            .GetOutValue("ERROR_MESSAGE", out outMessage);
            return(new ReturnResult <Province>()
            {
                ErrorCode = outCode,
                ErrorMessage = outMessage,
            });
        }
Ejemplo n.º 4
0
 public ReturnResult <Province> AddProvince(AddProvinceViewModel province)
 {
     return(ProvinceDAL.Add(province));
 }