public static FileGroupItemsViewModel ToViewModel(this FileGroupItemsModel x)
 {
     if (x == null)
     {
         return(new FileGroupItemsViewModel());
     }
     return(new FileGroupItemsViewModel
     {
         Id = x.Id,
         CreatedBy = x.CreatedBy,
         UpdatedBy = x.UpdatedBy,
         CreatedOn = x.CreatedOn,
         UpdatedOn = x.UpdatedOn,
         IsDeleted = x.IsDeleted,
         IsActive = x.IsActive,
         Filename = x.Filename,
         MimeType = x.MimeType,
         Thumbnail = x.Thumbnail,
         Size = x.Size,
         Path = x.Path,
         OriginalName = x.OriginalName,
         OnServer = x.OnServer,
         TypeId = x.TypeId,
     });
 }
示例#2
0
 public long FileGroupItemsInsert(FileGroupItemsModel model)
 {
     using (var dbctx = DbContext)
     {
         var id = dbctx.FileGroupItemInsert(model.CreatedBy, model.Filename, model.MimeType, model.Thumbnail, model.Size, model.Path, model.OriginalName, model.OnServer, model.TypeId, model.Type).FirstOrDefault();
         return(Convert.ToInt64(id ?? 0));
     }
 }
        public FileGroupItemsModel SetPathAndMoveSingleFile(FileGroupItemsModel model, long?id)
        {
            string path       = HttpContext.Current.Server.MapPath("\\file");
            string sourecPath = HttpContext.Current.Server.MapPath("\\tempfolder");

            model.Path      = MoveFileToTarget.MoveFile(sourecPath + "\\" + model.Filename, path + "\\" + id.ToString(), model.OriginalName, id);
            model.Filename  = model.OriginalName;
            model.Thumbnail = model.Path;
            return(model);
        }
 public long FileGroupItemsInsert(FileGroupItemsModel model)
 {
     return(_fileGroupDBService.FileGroupItemsInsert(model));
 }