Esempio n. 1
0
        public ActionResult <BillboardTypeListResponseModel> GetBillboardType()
        {
            BillboardTypeListResponseModel res = new BillboardTypeListResponseModel();

            try
            {
                BillboardTypeRepository repo = new BillboardTypeRepository(db);

                var query = repo.GetListAll();

                var data = (from x in query
                            select new BillboardTypeListOutputModel
                {
                    ID = x.ID,
                    Kode = x.Kode,
                    Type = x.Type
                }).ToList();

                res.data     = data;
                res.Message  = "Success get data";
                res.Response = true;
                return(res);
            }
            catch (Exception ex)
            {
                res.Message  = ex.Message;
                res.Response = true;
                return(res);
            }
        }
Esempio n. 2
0
        public AddBillboardTypeOutputModel Save(AddBillboardTypeInputModel data)
        {
            BillboardType temp = new BillboardType();

            temp.Kode = data.Kode;
            temp.Type = data.Type;

            BillboardTypeRepository repo = new BillboardTypeRepository(db);
            var res = repo.Insert(temp);

            AddBillboardTypeOutputModel output = new AddBillboardTypeOutputModel();

            output.ID = res.ID;

            return(output);
        }