Пример #1
0
        public RatingVo update(RatingVo input, Guid?ratingId = null)
        {
            using (var db = new MainDb())
            {
                if (ratingId == null)
                {
                    ratingId = input.ratingId;
                }

                var res = db.ratings.FirstOrDefault(e => e.ratingId == ratingId);

                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 RatingVo insert(RatingVo input)
        {
            using (var db = new MainDb())
            {
                db.ratings.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
Пример #3
0
        public ActionResult Edit(Guid id, RatingVo input)
        {
            if (this.ModelState.IsValid)
            {
                var res = ratingManager.update(input, id);
                return(RedirectToAction("Index"));
            }

            return(View(input));
        }
Пример #4
0
        public ActionResult Create(RatingVo input)
        {
            if (this.ModelState.IsValid)
            {
                var item = ratingManager.insert(input);
                return(RedirectToAction("Index"));
            }


            return(View(input));
        }
Пример #5
0
        public ActionResult Create()
        {
            var vo = new RatingVo();

            return(View(vo));
        }