예제 #1
0
        public bool Update(KhachhangModel model)
        {
            string msgError = "";

            try
            {
                var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "sp_khach_hang_update",
                                                                              "@makh", model.ma_kh,
                                                                              "@tenkh", model.ten_kh,
                                                                              "@diachi", model.dia_chi,
                                                                              "@sdt", model.sdt);
                if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError))
                {
                    throw new Exception(Convert.ToString(result) + msgError);
                }
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public bool Create(KhachhangModel model)
        {
            string msgError = "";

            try
            {
                var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "kh_item_create",
                                                                              "@makhachhang", model.makhachhang,
                                                                              "@tenkhachhang", model.tenkhachhang,
                                                                              "@diachi", model.diachi,
                                                                              "@sodienthoai", model.sodienthoai);
                if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError))
                {
                    throw new Exception(Convert.ToString(result) + msgError);
                }
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public KhachhangModel Update([FromBody] KhachhangModel model)
 {
     _itemBusiness.Update(model);
     return(model);
 }
 public KhachhangModel CreateItem([FromBody] KhachhangModel model)
 {
     _itemBusiness.Create(model);
     return(model);
 }
 public bool Create(KhachhangModel model)
 {
     return(_res.Create(model));
 }
 public bool Update(KhachhangModel model)
 {
     return(_res.Update(model));
 }
예제 #7
0
 public KhachhangModel CreateKhachhang([FromBody] KhachhangModel model)
 {
     model.ma_kh = Guid.NewGuid().ToString();
     _itemBusiness.Create(model);
     return(model);
 }