예제 #1
0
        public async Task <ActionResult> Add(Links links)
        {
            var entry = await LinksService.GetByIdAsync(links.Id);

            bool b;

            if (entry is null)
            {
                b = await LinksService.AddEntitySavedAsync(links) > 0;
            }
            else
            {
                entry.Url       = links.Url;
                entry.Except    = links.Except;
                entry.Name      = links.Name;
                entry.Recommend = links.Recommend;
                b = await LinksService.SaveChangesAsync() > 0;
            }

            return(b ? ResultData(null, message: "添加成功!") : ResultData(null, false, "添加失败!"));
        }