Example #1
0
        public async Task <BaseResult> CreateOrUpdate(NewsModel model, int updateBy = 0, string updateByUserName = "")
        {
            var news = model.ToNews();

            //Cập nhật thông tin chung của thực thể
            news = news.UpdateCommonInt(updateBy, updateByUserName);
            if (news.Id > 0)
            {
                //Cập nhật
                return(await Update(news));
            }
            else
            {
                //Thêm mới
                return(await Create(news));
            }
        }