예제 #1
0
        public AddProvinceOutputModel Save(AddProviceInputModel data)
        {
            ProvinceRepository repo = new ProvinceRepository(db);

            Province temp = new Province();

            temp.Kode           = data.Kode;
            temp.Provinsi       = data.Provinsi;
            temp.CreateByUserID = data.UserID;
            temp.CreateDate     = DateTime.Now;

            var res = repo.Insert(temp);

            AddProvinceOutputModel xres = new AddProvinceOutputModel();

            xres.ProvinsiID = res.ID;

            return(xres);
        }
예제 #2
0
        public ActionResult <AddProvinceResponseModel> AddProvince([FromBody] AddProviceInputModel data)
        {
            AddProvinceResponseModel res = new AddProvinceResponseModel();

            try
            {
                ProvinceBL bl   = new ProvinceBL(db);
                var        res2 = bl.Save(data);

                res.data     = res2;
                res.Message  = "Success get data";
                res.Response = true;
                return(res);
            }
            catch (Exception ex)
            {
                res.Message  = ex.Message;
                res.Response = false;
                return(res);
            }
        }