Example #1
0
        public async Task <IActionResult> Delete(RequestDataModel request)
        {
            var settings     = new JsonSerializerSettings();
            var searchObject = new LocaltionModel
            {
            };

            settings.DateFormatString = "dd/MM/yyyy";
            searchObject = JsonConvert.DeserializeObject <LocaltionModel>(request.model, settings);

            var localtion = new LocaltionModel();

            localtion = searchObject;
            localtion.LastModifyDate = DateTime.Now;
            var hostAPI = url;
            var rs      = await ApiProvider.PostAsync <int>(hostAPI, ApiConstant.DeleteLocaltion, localtion);

            if (rs == Constant.ReturnExcuteFunction.Success)
            {
                return(Json(new { messege = "Thành công !" }));
            }
            else
            {
                return(Json(new { messege = "Thất bại!" }));
            }
        }
Example #2
0
        public int CreateOrUpdate(LocaltionModel model)
        {
            string msgError = "";

            try
            {
                var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "LOCALTION_INSERT_OR_UPDATE",
                                                                              "@id", model.Id,
                                                                              "@localtion_code", model.Localtion_Code,
                                                                              "@localtion_name", model.Localtion_Name,
                                                                              "@point_x", model.Point_X,
                                                                              "@poin_y", model.Point_Y,
                                                                              "@description", model.Description,
                                                                              "@active", model.Active);
                if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError))
                {
                    throw new Exception(Convert.ToString(result) + msgError);
                }
                else
                {
                    return(Constant.ReturnExcuteFunction.Success);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public async Task <IActionResult> GetByID(RequestDataModel request)
        {
            var settings     = new JsonSerializerSettings();
            var searchObject = new LocaltionModel
            {
            };

            settings.DateFormatString = "dd/MM/yyyy";
            searchObject = JsonConvert.DeserializeObject <LocaltionModel>(request.model, settings);

            var localtion = new LocaltionModel();

            localtion = searchObject;
            localtion.LastModifyDate = DateTime.Now;
            var hostAPI = url;
            var rs      = await ApiProvider.PostAsync <LocaltionModel>(hostAPI, ApiConstant.GetLocaltionId, localtion);

            return(Json(rs));
        }
Example #4
0
        public int Delete(LocaltionModel model)
        {
            string msgError = "";

            try
            {
                var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "sp_localtion_delete",
                                                                              "@id", model.Id);
                if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError))
                {
                    throw new Exception(Convert.ToString(result) + msgError);
                }
                else
                {
                    return(Constant.ReturnExcuteFunction.Success);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        public async Task <IActionResult> GetData(RequestDataModel request)
        {
            var localtionModelParamater = new LocaltionModelParameter();
            var settings     = new JsonSerializerSettings();
            var searchObject = new LocaltionModel
            {
            };

            settings.DateFormatString = "dd/MM/yyyy";
            searchObject = JsonConvert.DeserializeObject <LocaltionModel>(request.model, settings);
            var page = new PageParameter
            {
                PageIndex = request.start,
                PageSize  = request.length
            };

            localtionModelParamater.Page = page;
            localtionModelParamater.Data = searchObject;
            var hostAPI = url;
            var data    = await ApiProvider.PostAsync <LocaltionReturnModel>(hostAPI, ApiConstant.GetAllLocaltion, localtionModelParamater);

            return(Json(data));
        }
Example #6
0
 public int Delete(LocaltionModel model)
 {
     return(_res.Delete(model));
 }
Example #7
0
 public int CreateOrUpdate(LocaltionModel model)
 {
     return(_res.CreateOrUpdate(model));
 }
Example #8
0
 public int Delete([FromBody] LocaltionModel model)
 {
     return(_bus.Delete(model));
 }
Example #9
0
 public int CreateOrUpdate([FromBody] LocaltionModel model)
 {
     return(_bus.CreateOrUpdate(model));
 }
Example #10
0
 public LocaltionModel GetDataID([FromBody] LocaltionModel model)
 {
     return(_bus.GetDataByID(model.Id));
 }