public CreateFileResponse CreateFile(CreateFileRequest request) { var response = new CreateFileResponse(); try { Guard.ArgNotNull(request, "request"); var f = new File { Name = request.Name, Description = request.Description, Data = request.Data, LastModified = request.LastModified, Snippet_Id = request.SnippetId }; _unitOfWork.FileRepository.Insert(f); _unitOfWork.Save(); response.Success = true; response.FileId = f.Id; } catch (Exception ex) { response.Success = false; response.FailureInformation = ex.Message; Logger.LogError("CreateFile Method Failed", ex); } return response; }
/// <summary> /// Create a new File object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="data">Initial value of the Data property.</param> /// <param name="lastModified">Initial value of the LastModified property.</param> /// <param name="snippet_Id">Initial value of the Snippet_Id property.</param> public static File CreateFile(global::System.Int32 id, global::System.String name, global::System.Byte[] data, global::System.DateTime lastModified, global::System.Int32 snippet_Id) { File file = new File(); file.Id = id; file.Name = name; file.Data = data; file.LastModified = lastModified; file.Snippet_Id = snippet_Id; return file; }
/// <summary> /// Deprecated Method for adding a new object to the Files EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToFiles(File file) { base.AddObject("Files", file); }