コード例 #1
0
        public BusinessCategoryLookupVo update(BusinessCategoryLookupVo input, Guid?businessCategoryLookupId = null)
        {
            using (var db = new MainDb())
            {
                if (businessCategoryLookupId == null)
                {
                    businessCategoryLookupId = input.businessCategoryLookupId;
                }

                var res = db.businessCategoryLookups.FirstOrDefault(e => e.businessCategoryLookupId == businessCategoryLookupId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
コード例 #2
0
        public BusinessCategoryLookupVo insert(BusinessCategoryLookupVo input)
        {
            using (var db = new MainDb())
            {
                db.businessCategoryLookups.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
コード例 #3
0
        public ActionResult Edit(Guid id, BusinessCategoryLookupVo input)
        {
            if (this.ModelState.IsValid)
            {
                var res = businessCategoryLookupManager.update(input, id);
                return(RedirectToAction("Index"));
            }

            return(View(input));
        }
コード例 #4
0
        public ActionResult Create(BusinessCategoryLookupVo input)
        {
            if (this.ModelState.IsValid)
            {
                var item = businessCategoryLookupManager.insert(input);
                return(RedirectToAction("Index"));
            }


            return(View(input));
        }
コード例 #5
0
        public ActionResult Create()
        {
            var vo = new BusinessCategoryLookupVo();

            return(View(vo));
        }