//public IHttpActionResult Add(Int64 noticeId, string title, string content, string url) public IHttpActionResult Add(NoticeModel model) { Notice obj; if (model.NoticeId > 0) { obj = Notice.GetNotice(model.NoticeId); obj.Title = model.Title; obj.Content = model.Content; obj.Url = model.Url; obj.LastUser = "******"; } else { obj = Business.Notice.NewNotice(); obj.NoticeId = model.NoticeId; obj.Title = model.Title; obj.Content = model.Content; obj.Url = model.Url; obj.LastUser = "******"; } obj.ApplyEdit(); var temp = obj.Clone(); obj = temp.Save(); // reload list var notices = NoticeColl.GetNoticeColl(); var result = new List <Models.NoticeModel>(); foreach (var item in notices) { result.Add(new Models.NoticeModel { NoticeId = item.NoticeId, Content = item.Content, LastModified = item.LastModefied.ToString("yyyy/MM/dd HH:ss"), LastUser = item.LastUser, Title = item.Title, Url = item.Url }); } return(Ok(new { data = result, success = "true", message = "success" })); }