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 List <FileGroupItemsModel> SetPathAndMoveFile(List <FileGroupItemsModel> model, long?id) { string path = HttpContext.Current.Server.MapPath("\\file"); string sourecPath = HttpContext.Current.Server.MapPath("\\tempfolder"); foreach (var item in model) { if (item.Id == 0 || item.Id == null) { item.Path = MoveFileToTarget.MoveFile(sourecPath + "\\" + item.Filename, path + "\\" + id.ToString(), item.OriginalName, id); item.Filename = item.OriginalName; item.Thumbnail = item.Path; } } return(model); }