Exemplo n.º 1
0
        public DataRespond updateChiBo(ChiBoRequest cb)
        {
            DataRespond data = new DataRespond();

            try
            {
                ChiBo chb = m_chiBoResponsitory.getChiBoById(cb.cbid);
                chb.cbid   = cb.cbid;
                chb.tencb  = cb.tencb;
                chb.dbid   = cb.dbid;
                chb.active = cb.active == 0 ? true : false;
                DateTime ngaytl = DateTime.ParseExact(cb.ngaythanhlap, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                chb.ngaythanhlap = ngaytl;

                data.success = true;
                m_chiBoResponsitory.updateChiBo(chb);
            }
            catch (Exception e)
            {
                data.success = false;
                data.error   = e;
                data.message = e.Message;
            }
            return(data);
        }
Exemplo n.º 2
0
        public DataRespond insertChiBo([FromBody] ChiBoRequest cb)
        {
            DataRespond data = new DataRespond();

            try
            {
                ChiBo chb = new ChiBo();
                chb.tencb  = cb.tencb;
                chb.dbid   = cb.dbid;
                chb.active = cb.active == 0 ? true : false;
                DateTime ngaytl = DateTime.ParseExact(cb.ngaythanhlap, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                chb.ngaythanhlap = ngaytl;
                chb.createday    = DateTime.Now;

                data.success = true;
                m_chiBoResponsitory.insertChoBo(chb);
                data.message = "Insert success!";
            }
            catch (Exception e)
            {
                data.success = false;
                data.error   = e;
                data.message = e.Message;
            }
            return(data);
        }