예제 #1
0
        public IActionResult Create([FromBody]HREditorialUserMap newObj)
        {
            if (newObj == null)
            { return BadRequest(); }

            _context.HREditorialUserMap.Add(newObj);
            _context.SaveChanges();

            return CreatedAtRoute("GetHREditorialUserMap", new { id = newObj.HREditorialUserMapID }, newObj);
        }
예제 #2
0
        public void HREditorialUserMap()
        {
            IQueryable <HREditorialUserMap> HREditorialUserMapCollection = Enumerable.Empty <HREditorialUserMap>().AsQueryable();
            HREditorialUserMap ct = new HREditorialUserMap {
                HREditorialUserMapID = 1, HumanReviewUserID = "Test HRID"
            };

            Mock <IHREditorialUserMapRepository> HREditorialUserMapService = new Mock <IHREditorialUserMapRepository>();

            object obj = new object();

            try
            {
                HREditorialUserMapService.Setup(x => x.GetAll()).Returns(HREditorialUserMapCollection);
                HREditorialUserMapService.Setup(x => x.Get(It.IsAny <int>())).Returns(ct);
                HREditorialUserMapService.Setup(x => x.Add(It.IsAny <HREditorialUserMap>())).Returns(ct);
                HREditorialUserMapService.Setup(x => x.Delete(It.IsAny <HREditorialUserMap>())).Verifiable();
                HREditorialUserMapService.Setup(x => x.Update(It.IsAny <HREditorialUserMap>(), It.IsAny <object>())).Returns(ct);
                HREditorialUserMapService.Setup(x => x.GetIdIncluding(It.IsAny <int>())).Returns(ct);
                HREditorialUserMapService.Setup(x => x.GetAllIncludingByName(It.IsAny <string>())).Returns(HREditorialUserMapCollection);


                var HREditorialUserMapObject = HREditorialUserMapService.Object;
                var p1 = HREditorialUserMapObject.GetAll();
                var p2 = HREditorialUserMapObject.Get(1);
                var p3 = HREditorialUserMapObject.Update(ct, obj);
                var p4 = HREditorialUserMapObject.Add(ct);
                var p5 = HREditorialUserMapObject.GetIdIncluding(1);
                var p6 = HREditorialUserMapObject.GetAllIncludingByName("test");

                HREditorialUserMapObject.Delete(ct);

                Assert.IsAssignableFrom <IQueryable <HREditorialUserMap> >(p1);
                Assert.IsAssignableFrom <HREditorialUserMap>(p2);
                Assert.Equal("Test HRID", p2.HumanReviewUserID);
                Assert.Equal("Test HRID", p3.HumanReviewUserID);
                Assert.Equal("Test HRID", p4.HumanReviewUserID);
                Assert.IsAssignableFrom <HREditorialUserMap>(p4);
                Assert.IsAssignableFrom <HREditorialUserMap>(p5);
                Assert.Equal("Test HRID", p5.HumanReviewUserID);
                Assert.IsAssignableFrom <IQueryable <HREditorialUserMap> >(p6);

                HREditorialUserMapService.VerifyAll();

                HREditorialUserMapObject.Dispose();
            }
            finally
            {
                HREditorialUserMapService = null;
            }
        }
예제 #3
0
        public IActionResult UpdateEntry([FromBody] HREditorialUserMap objupd)
        {
            var targetObject = _context.HREditorialUserMap.FirstOrDefault(t => t.HREditorialUserMapID == objupd.HREditorialUserMapID);
            if (targetObject == null)
            { return NotFound(); }

            _context.Entry(targetObject).CurrentValues.SetValues(objupd);
            ReturnData ret;

            ret = _context.SaveData();

            if (ret.Message == "Success")
            { return Ok(); }

            return NotFound(ret);
        }
예제 #4
0
        public IActionResult Update([FromBody] HREditorialUserMap editentry)
        {
            var result = _repository.Update(editentry, editentry.HREditorialUserMapID);

            return(Helper.CheckResult(result));
        }
예제 #5
0
        public IActionResult Create([FromBody] HREditorialUserMap newentry)
        {
            var result = _repository.Add(newentry);

            return(Helper.CheckResult(result));
        }