// DELETE api/noticeboard/5 public dtoCretePostResponse Delete([FromUri] int id) { dtoSocialDashboardPermissionResponse dpr = (dtoSocialDashboardPermissionResponse)CoreService.PermissionGet( COL_BusinessLogic_v2.UCServices.Services_SocialNoticeboard.Codex, UserContext.CurrentUserID, UserContext.CurrentCommunityID); dtoCretePostResponse response = new dtoCretePostResponse(); response.ErrorInfo = base.LastError; if (!dpr.Admin && !dpr.Delete) { response.Success = false; response.ErrorInfo = GenericError.NoServicePermission; } if (id < 1) { response.Success = false; response.ErrorInfo = GenericError.InvalidDataInput; } if (id < 1 && (!dpr.Admin && !dpr.Delete)) { response.Success = false; response.ErrorInfo = GenericError.InvalidDataInput; } if (response.ErrorInfo == GenericError.None) { response.Comment = Service.PostDelete(id); if (response.Comment != null && response.Comment.Id <= 0) { response.ErrorInfo = GenericError.Internal; } else { response.Success = true; } } //In ActionFilters CheckResponse(response); return(response); }
// Post api/esempio/ /// <summary> /// Crea un nuovo messaggio nella bacheca social /// </summary> /// <param name="data">dtoCommentCreate</param> /// <returns>dtoCretePostResponse</returns> public dtoCretePostResponse Post( SocialNoticeBoard.Domain.DTO.dtoCommentCreate data) { // Blocco da rendere "generico" su TUTTE le chiamate, esclusa login!!! dtoSocialDashboardPermissionResponse dpr = (dtoSocialDashboardPermissionResponse)CoreService.PermissionGet( COL_BusinessLogic_v2.UCServices.Services_SocialNoticeboard.Codex, UserContext.CurrentUserID, UserContext.CurrentCommunityID); dtoCretePostResponse response = new dtoCretePostResponse(); response.ErrorInfo = base.LastError; if (!dpr.Admin && !(dpr.Comment && data.ParentMessageId != null) && !(dpr.NewPost && data.ParentMessageId == null)) { response.Success = false; response.ErrorInfo = GenericError.NoServicePermission; } if (data == null) { response.Success = false; response.ErrorInfo = GenericError.InvalidDataInput; } if (response.ErrorInfo == GenericError.None) { response.Comment = Service.PostCreate(data); if (response.Comment != null && response.Comment.Id <= 0) { response.ErrorInfo = GenericError.Internal; } else { response.Success = true; } } //In ActionFilters CheckResponse(response); return(response); }