예제 #1
0
        //start cate_kind
        public async Task <bool> AddCateKind(CateKind entity)
        {
            _dbContext.Cate_Kinds.Add(entity);
            try
            {
                await _dbContext.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #2
0
        public async Task <bool> UpdateCateKind(CateKind entity)
        {
            var item = await _dbContext.Cate_Kinds.FirstOrDefaultAsync(x => x.ID == entity.ID);

            item.Cate_Kind_Name = entity.Cate_Kind_Name;

            try
            {
                await _dbContext.SaveChangesAsync();

                return(true);
            }
            catch (Exception ex)
            {
                var message = ex.Message;
                //logging
                return(false);
            }
        }
예제 #3
0
 public async Task <IActionResult> UpdateCateKind([FromBody] CateKind entity)
 {
     return(Ok(await _categoryService.UpdateCateKind(entity)));
 }