示例#1
0
        public bool UpdateGrade(int GradeId, GradeEnities GradeEntities)
        {
            var success = false;

            if (GradeEntities != null)
            {
                //using (var scope = new TransactionScope())
                //{
                var GradeDetail = _UOW.GRADERepository.GetByID(GradeId);
                if (GradeDetail != null)
                {
                    if (GradeEntities.GRADE_NAME != null && GradeEntities.GRADE_NAME != "")
                    {
                        GradeDetail.GRADE_NAME = GradeEntities.GRADE_NAME;
                    }

                    _UOW.GRADERepository.Update(GradeDetail);
                    _UOW.Save();
                    cache.Remove(CacheKey);
                    //scope.Complete();
                    success = true;
                    //}
                }
            }
            return(success);
        }
示例#2
0
 // PUT api/grade/5
 public bool Put(int id, [FromBody] GradeEnities Grade)
 {
     if (id > 0)
     {
         return(_Grade.UpdateGrade(id, Grade));
     }
     return(false);
 }
示例#3
0
 public int CreateGrade(GradeEnities GradeEntities)
 {
     if (GradeEntities != null)
     {
         var GradeDetail = new TBL_HRMS_GRADE_MASTER
         {
             GRADE_NAME = GradeEntities.GRADE_NAME,
         };
         _UOW.GRADERepository.Insert(GradeDetail);
         _UOW.Save();
         cache.Remove(CacheKey);
     }
     return(Convert.ToInt32(GradeEntities.ID));
 }
        public async Task <ActionResult> gradeCreate(GradeEnities dept)
        {
            //if (ModelState.IsValid)
            //{

            HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url + "grade", dept);

            if (responseMessage.IsSuccessStatusCode)
            {
                TempData["sucsmsg"] = "saved";
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> gradeEdit(GradeEnities dept, FormCollection fc)
        {
            int id = Convert.ToInt32(fc["rowid3"]);
            //if (ModelState.IsValid)
            //{

            HttpResponseMessage responseMessage = await client.PutAsJsonAsync(url + "grade/" + id, dept);

            if (responseMessage.IsSuccessStatusCode)
            {
                TempData["sucmsgupdate"] = "saved";
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Index"));
        }
示例#6
0
 // POST api/grade
 public int Post([FromBody] GradeEnities Grade)
 {
     return(_Grade.CreateGrade(Grade));
 }